| Total Complexity | 4 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class PirateReactionMetadata |
||
| 6 | { |
||
| 7 | /** @var array<int, int> $reactions */ |
||
| 8 | private array $reactions = []; |
||
| 9 | |||
| 10 | 2 | public function addReaction(PirateBehaviourEnum $reaction): void |
|
| 11 | { |
||
| 12 | 2 | $key = $reaction->value; |
|
| 13 | |||
| 14 | 2 | if (!array_key_exists($key, $this->reactions)) { |
|
| 15 | 2 | $this->reactions[$key] = 1; |
|
| 16 | } else { |
||
| 17 | 1 | $this->reactions[$key]++; |
|
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 21 | 3 | public function getReactionAmount(PirateBehaviourEnum $reaction): int |
|
| 30 | } |
||
| 31 | } |
||
| 32 |