Lines
100.00%
4 / 4
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| EventBundle | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 3 | 100.00% | 1 / 1 | |||
| events | n/a | 0 / 0 | n/a | 0 / 0 | 0 | |||||
| contains | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 3 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Server\Event; | |
| 6 | ||
| 7 | abstract readonly class EventBundle | |
| 8 | { | |
| 9 | /** @return non-empty-list<class-string<Event>> */ | |
| 10 | abstract public static function events(): array; | |
| 11 | ||
| 12 | final public static function contains(mixed $answer): bool | |
| 13 | { | |
| 14 | foreach (static::events() as $event) { | |
| 15 | if ($answer instanceof $event) { | |
| 16 | return true; | |
| 17 | } | |
| 18 | } | |
| 19 | ||
| 20 | return false; | |
| 21 | } | |
| 22 | } |