Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
77.78% |
7 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ValueOptionList | |
77.78% |
7 / 9 |
|
0.00% |
0 / 2 |
5.27 | |
0.00% |
0 / 1 |
| hasIntegerKeys | |
87.50% |
7 / 8 |
|
0.00% |
0 / 1 |
4.03 | |||
| offsetGet | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\Core\Lists; |
| 3 | |
| 4 | use Apie\Core\Dto\ValueOption; |
| 5 | |
| 6 | final class ValueOptionList extends ItemList |
| 7 | { |
| 8 | protected bool $mutable = false; |
| 9 | |
| 10 | private bool $integerKeys; |
| 11 | |
| 12 | public function hasIntegerKeys(): bool |
| 13 | { |
| 14 | if (isset($this->integerKeys)) { |
| 15 | return $this->integerKeys; |
| 16 | } |
| 17 | foreach ($this->internal as $value) { |
| 18 | if (preg_match('/^\d+$/', $value->name)) { |
| 19 | $this->integerKeys = true; |
| 20 | return true; |
| 21 | } |
| 22 | } |
| 23 | $this->integerKeys = false; |
| 24 | return false; |
| 25 | } |
| 26 | |
| 27 | public function offsetGet(mixed $offset): ValueOption |
| 28 | { |
| 29 | return parent::offsetGet($offset); |
| 30 | } |
| 31 | |
| 32 | |
| 33 | } |