Lines
100.00%
5 / 5
Functions and Methods
100.00%
3 / 3
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| QuestDone | 100.00% | 5 / 5 | 100.00% | 3 / 3 | 3 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| describe | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| holds | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Bot\Steps\Checks; | |
| 6 | ||
| 7 | use Generator; | |
| 8 | use Lorekeeper\Bot\Steps\Check; | |
| 9 | use Lorekeeper\Bot\Steps\StepScript; | |
| 10 | use Lorekeeper\Core\World\Quest\QuestId; | |
| 11 | use Override; | |
| 12 | ||
| 13 | final readonly class QuestDone implements Check | |
| 14 | { | |
| 15 | public function __construct( | |
| 16 | public QuestId $quest, | |
| 17 | ) {} | |
| 18 | ||
| 19 | #[Override] | |
| 20 | public function describe(): string | |
| 21 | { | |
| 22 | return "Quest {$this->quest->value} was already done"; | |
| 23 | } | |
| 24 | ||
| 25 | #[Override] | |
| 26 | public function holds(StepScript $bot): Generator | |
| 27 | { | |
| 28 | $checking = $bot->alreadyDone($this->quest); | |
| 29 | yield from $checking; | |
| 30 | ||
| 31 | return $checking->getReturn(); | |
| 32 | } | |
| 33 | } |