| Conditions | 5 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 5.1158 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | protected function validateConditions(array $conditions) |
||
| 17 | { |
||
| 18 | if (count($conditions) == 0) { |
||
| 19 | throw new \Exception($this->returns . ' can not be matched because the matching conditions are empty'); |
||
| 20 | } |
||
| 21 | |||
| 22 | if (count($conditions) > $this->maxConditions) { |
||
| 23 | 20 | throw new \Exception($this->returns . " can not be matched because multiple matching conditions are specified. Only {this->maxConditions} condition(s) are supported"); |
|
| 24 | } |
||
| 25 | 20 | ||
| 26 | 20 | foreach ($conditions as $key => $value) { |
|
| 27 | if (!in_array((string)$key, $this->allowedConditions)) { |
||
| 28 | 3 | throw new \Exception($this->returns . " can not be matched because matching condition '$key' is not supported. Supported conditions are: " . |
|
| 29 | implode(', ', $this->allowedConditions)); |
||
| 30 | 3 | } |
|
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 46 |