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