Lines
100.00%
2 / 2
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| QuestDescription | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Core\World\Quest; | |
| 6 | ||
| 7 | use Psl\Option; | |
| 8 | use Psl\Type; | |
| 9 | ||
| 10 | final readonly class QuestDescription | |
| 11 | { | |
| 12 | /** @var non-empty-string */ | |
| 13 | public string $description; | |
| 14 | ||
| 15 | /** @var Option\Option<non-empty-string> */ | |
| 16 | public Option\Option $endText; | |
| 17 | ||
| 18 | public function __construct(string $description, string $endText = '') | |
| 19 | { | |
| 20 | $this->description = Type\non_empty_string()->assert($description); | |
| 21 | $this->endText = '' === $endText ? Option\none() : Option\some($endText); | |
| 22 | } | |
| 23 | } |