Lines
100.00%
3 / 3
Functions and Methods
100.00%
3 / 3
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Identity | 100.00% | 3 / 3 | 100.00% | 3 / 3 | 3 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| is | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| owns | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Client\Tracking; | |
| 6 | ||
| 7 | use Lorekeeper\Core\Player\PlayerName; | |
| 8 | use Lorekeeper\Core\Player\PlayerSpawnId; | |
| 9 | ||
| 10 | final readonly class Identity | |
| 11 | { | |
| 12 | public function __construct( | |
| 13 | public PlayerSpawnId $spawnId, | |
| 14 | public PlayerName $name, | |
| 15 | ) {} | |
| 16 | ||
| 17 | public function is(PlayerName $name): bool | |
| 18 | { | |
| 19 | return strcasecmp($name->value, $this->name->value) === 0; | |
| 20 | } | |
| 21 | ||
| 22 | public function owns(PlayerSpawnId $spawnId): bool | |
| 23 | { | |
| 24 | return $spawnId->equals($this->spawnId); | |
| 25 | } | |
| 26 | } |