| Total Complexity | 4 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | final class AttackOrder extends Collection |
||
| 13 | { |
||
| 14 | public static function resolve(Fighter ...$fighters): self |
||
| 15 | { |
||
| 16 | return new self( |
||
| 17 | sort( |
||
| 18 | static fn(Fighter $one, Fighter $another) => |
||
| 19 | $one->getInitiative()->get() <=> $another->getInitiative()->get(), |
||
| 20 | $fighters, |
||
| 21 | ), |
||
| 22 | ); |
||
| 23 | } |
||
| 24 | |||
| 25 | public function first(): Fighter |
||
| 26 | { |
||
| 27 | return first($this->items); |
||
|
|
|||
| 28 | } |
||
| 29 | |||
| 30 | public function last(): Fighter |
||
| 31 | { |
||
| 32 | return last($this->items); |
||
| 33 | } |
||
| 34 | |||
| 35 | protected function getType(): string |
||
| 38 | } |
||
| 39 | } |
||
| 40 |