Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
65 | 24 | public function offsetSet($index, $newval) |
|
66 | { |
||
67 | 24 | if (!$newval instanceof WzItemInterface) { |
|
68 | 3 | throw new InvalidArgumentException(sprintf('Only `%s` objects allowed.', WzItemInterface::class)); |
|
69 | } |
||
70 | |||
71 | 21 | if ($index !== $newval->getId()) { |
|
72 | 3 | throw new InvalidArgumentException(sprintf( |
|
73 | 3 | "Key `%s` doesn't match `%s->getId()`: `%s`.", |
|
74 | 1 | $index, |
|
75 | 3 | WzItemInterface::class, |
|
76 | 3 | $newval->getId())); |
|
77 | } |
||
78 | |||
79 | 18 | parent::offsetSet($index, $newval); |
|
80 | 18 | } |
|
81 | } |
||
82 |