| Conditions | 1 |
| Paths | 1 |
| Total Lines | 9 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 20 | public function applyRule($parameterName, $value, $itemType = false) |
|
| 15 | { |
||
| 16 | 20 | $this->getMethod() |
|
| 17 | 20 | ->addChild('// validation for constraint: boolean') |
|
| 18 | 20 | ->addChild(sprintf('if (!is_null($%1$s) && !is_bool($%1$s)) {', $parameterName)) |
|
| 19 | 20 | ->addChild($this->getMethod()->getIndentedString(sprintf('throw new \InvalidArgumentException(sprintf(\'Invalid value, please provide a bool, "%%s" given\', gettype($%s)), __LINE__);', $parameterName), 1)) |
|
| 20 | 20 | ->addChild('}'); |
|
| 21 | 20 | return $this; |
|
| 22 | } |
||
| 23 | } |
||
| 24 |