| Total Complexity | 4 |
| Total Lines | 15 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | final class TotalDigitsRule extends AbstractRule |
||
| 14 | { |
||
| 15 | 6 | public function name(): string |
|
| 16 | { |
||
| 17 | 6 | return 'totalDigits'; |
|
| 18 | } |
||
| 19 | |||
| 20 | 6 | public function testConditions(string $parameterName, $value, bool $itemType = false): string |
|
| 21 | { |
||
| 22 | 6 | return sprintf(($itemType ? '' : '!is_null($%1$s) && ').'mb_strlen(preg_replace(\'/(\D)/\', \'\', (string) $%1$s)) > %2$d', $parameterName, $value); |
|
| 23 | } |
||
| 24 | |||
| 25 | 6 | public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string |
|
| 28 | } |
||
| 29 | } |
||
| 30 |