| Conditions | 4 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php declare(strict_types=1); |
||
| 23 | 5 | public function insert($element, $index): self { |
|
| 24 | 5 | if (null === $index) { |
|
| 25 | 2 | return $this->add($element); |
|
| 26 | } |
||
| 27 | |||
| 28 | 5 | if (is_int($index)) { |
|
| 29 | 3 | array_splice($this->array, $index, 0, $element); |
|
| 30 | } |
||
| 31 | |||
| 32 | 5 | if (is_string($index)) { |
|
| 33 | 2 | $this->array[$index] = $element; |
|
|
|
|||
| 34 | } |
||
| 35 | |||
| 36 | 5 | return $this; |
|
| 37 | } |
||
| 39 |