Conditions | 4 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
49 | 21 | public function add($key, $value) |
|
50 | { |
||
51 | 21 | if (!is_string($key)) { |
|
52 | 1 | throw new \RuntimeException('The key must be a string'); |
|
53 | } |
||
54 | |||
55 | 21 | if (!is_scalar($value) and !is_null($value)) { |
|
56 | 1 | throw new \RuntimeException(sprintf('The "%s" value must be a scalar or null', $key)); |
|
57 | } |
||
58 | |||
59 | 21 | $this->data[$key] = $value; |
|
60 | 21 | } |
|
71 |