Total Complexity | 7 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class FieldCollection extends AbstractCollection implements CollectionInterface |
||
13 | { |
||
14 | /** |
||
15 | * @param $name |
||
16 | * @return FieldInterface|null |
||
17 | */ |
||
18 | 4 | public function findByName($name) |
|
19 | { |
||
20 | 4 | $this->rewind(); |
|
21 | 4 | while ($this->valid()) { |
|
22 | /** @var FieldInterface $field */ |
||
23 | 3 | $field = $this->current(); |
|
24 | 3 | if ($field->getName() == $name) { |
|
25 | 3 | return $field; |
|
26 | } |
||
27 | 1 | $this->next(); |
|
28 | } |
||
29 | 1 | $this->rewind(); |
|
30 | 1 | return null; |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param $name |
||
35 | * @return bool |
||
36 | */ |
||
37 | 1 | public function removeByName($name): bool |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * @return FieldInterface |
||
61 | */ |
||
62 | 56 | public function current(): FieldInterface |
|
65 | } |
||
66 | } |