| Total Complexity | 6 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 83.33% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | final class WeaponType implements \Stringable |
||
| 8 | { |
||
| 9 | public const SHORT_SWORD = 'Short Sword'; |
||
| 10 | public const GREAT_SWORD = 'Great Sword'; |
||
| 11 | public const BOW = 'Bow'; |
||
| 12 | |||
| 13 | 6 | public function __construct( |
|
| 14 | private string $type, |
||
| 15 | 6 | ) {} |
|
| 16 | |||
| 17 | 4 | public static function shortSword(): self |
|
| 18 | { |
||
| 19 | 4 | return new self(self::SHORT_SWORD); |
|
| 20 | } |
||
| 21 | |||
| 22 | 6 | public static function greatSword(): self |
|
| 23 | { |
||
| 24 | 6 | return new self(self::GREAT_SWORD); |
|
| 25 | } |
||
| 26 | |||
| 27 | public static function bow(): self |
||
| 30 | } |
||
| 31 | |||
| 32 | 4 | public function equals(self $type): bool |
|
| 33 | { |
||
| 34 | 4 | return $this->type === (string) $type; |
|
| 35 | } |
||
| 36 | |||
| 37 | 5 | public function __toString(): string |
|
| 40 | } |
||
| 41 | } |
||
| 42 |