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