Conditions | 6 |
Paths | 6 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
90 | 3 | private function parseVariables(array $array) |
|
91 | { |
||
92 | 3 | if (!array_key_exists('variables', $array)) { |
|
93 | 2 | return; |
|
94 | } |
||
95 | |||
96 | 2 | $variables = $array['variables']; |
|
97 | 2 | if (!is_array($variables)) { |
|
98 | 1 | throw new ParseException('variables must be a list of strings'); |
|
99 | } |
||
100 | |||
101 | 2 | foreach ($variables as $name => $value) { |
|
102 | 2 | if (null === $value) { |
|
103 | 1 | throw new ParseException("variable {$name} should be a string value (it is currently null or empty)"); |
|
104 | } |
||
105 | 2 | if (is_bool($value)) { |
|
106 | 1 | throw new ParseException("variable {$name} should be a string (it is currently defined as a boolean)"); |
|
107 | } |
||
108 | } |
||
109 | |||
110 | 1 | $variables = array_map('strval', $variables); |
|
111 | 1 | $this->variables = $variables; |
|
112 | } |
||
114 |