| Total Complexity | 9 |
| Total Lines | 66 |
| Duplicated Lines | 0 % |
| Coverage | 88.24% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | trait FieldSetViewTrait |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var array<string, ElementViewInterface> |
||
| 18 | */ |
||
| 19 | private $elements = []; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * {@inheritdoc} |
||
| 23 | */ |
||
| 24 | public function offsetExists($offset): bool |
||
| 25 | { |
||
| 26 | return isset($this->elements[$offset]); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * {@inheritdoc} |
||
| 31 | */ |
||
| 32 | 7 | public function offsetGet($offset): ElementViewInterface |
|
| 33 | { |
||
| 34 | 7 | return $this->elements[$offset]; |
|
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * {@inheritdoc} |
||
| 39 | */ |
||
| 40 | 2 | public function offsetSet($offset, $value): void |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * {@inheritdoc} |
||
| 47 | */ |
||
| 48 | 2 | public function offsetUnset($offset): void |
|
| 49 | { |
||
| 50 | 2 | throw new BadMethodCallException('FormView is read only'); |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * {@inheritdoc} |
||
| 55 | */ |
||
| 56 | 27 | public function hasError(): bool |
|
| 57 | { |
||
| 58 | 27 | if ($this->error() !== null) { |
|
| 59 | 11 | return true; |
|
| 60 | } |
||
| 61 | |||
| 62 | 16 | foreach ($this->elements as $element) { |
|
| 63 | 15 | if ($element->hasError()) { |
|
| 64 | 4 | return true; |
|
| 65 | } |
||
| 66 | } |
||
| 67 | |||
| 68 | 13 | return false; |
|
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * {@inheritdoc} |
||
| 73 | * |
||
| 74 | * @return Iterator<string, ElementViewInterface> |
||
| 75 | * @psalm-suppress ImplementedReturnTypeMismatch |
||
| 76 | */ |
||
| 77 | 9 | public function getIterator(): Iterator |
|
| 80 | } |
||
| 81 | } |
||
| 82 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.