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