| Total Complexity | 7 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 6 | abstract class AbstractArray extends \ArrayObject |
||
| 7 | { |
||
| 8 | protected $valueType; |
||
| 9 | |||
| 10 | 16 | public function __construct(string $valueType, array $array = [], int $flags = 0, string $iteratorClass = "ArrayIterator") { |
|
| 11 | 16 | $this->valueType = $valueType; |
|
| 12 | |||
| 13 | 16 | $this->checkAllElements($array); |
|
| 14 | |||
| 15 | 16 | parent::__construct($array, $flags, $iteratorClass); |
|
| 16 | 16 | } |
|
| 17 | |||
| 18 | 12 | public function offsetSet($offset, $value) |
|
| 19 | { |
||
| 20 | 12 | $this->checkType($value); |
|
| 21 | |||
| 22 | 10 | $this->checkOffset($offset); |
|
| 23 | |||
| 24 | 8 | parent::offsetSet($offset, $value); |
|
| 25 | 8 | } |
|
| 26 | |||
| 27 | 1 | public function exchangeArray($array) |
|
| 28 | { |
||
| 29 | 1 | $this->checkAllElements($array); |
|
| 30 | |||
| 31 | 1 | parent::exchangeArray($array); |
|
| 32 | 1 | } |
|
| 33 | |||
| 34 | 16 | protected function checkType($value): void |
|
| 38 | } |
||
| 39 | 14 | } |
|
| 40 | |||
| 41 | abstract protected function checkOffset($offset): void; |
||
| 42 | |||
| 43 | 16 | private function checkAllElements(array $array): void |
|
| 48 | 16 | }); |
|
| 49 | } |
||
| 50 | } |