| Total Complexity | 10 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class PersonCollection extends ArrayCollection |
||
| 12 | { |
||
| 13 | |||
| 14 | public function update(PersonEntity $person): void |
||
| 15 | 1 | { |
|
| 16 | $key = $this->findKey($person); |
||
| 17 | 1 | ||
| 18 | 1 | if($key) { |
|
| 19 | 1 | $this->offsetSet($key,$person); |
|
|
|
|||
| 20 | |||
| 21 | 1 | return; |
|
| 22 | } |
||
| 23 | 1 | ||
| 24 | throw new LogicException('Person was not in the collection.'); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function append(PersonEntity $person) |
||
| 28 | { |
||
| 29 | 4 | $this->add($person); |
|
| 30 | } |
||
| 31 | 4 | ||
| 32 | 4 | public function current(): ?PersonEntity |
|
| 35 | } |
||
| 36 | |||
| 37 | 1 | public function findKey(PersonEntity $person): int|bool |
|
| 51 | 2 | } |
|
| 52 | 1 | ||
| 53 | public function findById($id): PersonEntity|bool |
||
| 67 | 2 | } |
|
| 68 | } |
||
| 69 |