| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3.0416 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | 13 | private function convertToInteger($value): ?int |
|
| 39 | { |
||
| 40 | 13 | if($this->isConvertibleToString($value) === false) |
|
| 41 | { |
||
| 42 | throw new \InvalidArgumentException("Limit argument must be an integer or an integer wrapped into a string"); |
||
| 43 | } |
||
| 44 | |||
| 45 | 13 | if(preg_match('~^[\d]+$~', (string) $value)) |
|
| 46 | { |
||
| 47 | 8 | return (int) $value; |
|
| 48 | } |
||
| 49 | |||
| 50 | 5 | return null; |
|
| 51 | } |
||
| 52 | } |
||
| 53 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.