| Total Complexity | 6 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | #[Attribute(Attribute::TARGET_PROPERTY)] |
||
| 10 | class Cpf extends Document |
||
| 11 | { |
||
| 12 | public function __construct(bool $mask = true, ?string $message = 'CPF inválido') |
||
| 13 | { |
||
| 14 | parent::__construct($mask, $message); |
||
| 15 | } |
||
| 16 | |||
| 17 | public function isValidDocument(string $input): bool |
||
| 18 | { |
||
| 19 | if (!$this->validateNumbersWithCorrectLength($input)) { |
||
| 20 | return false; |
||
| 21 | } |
||
| 22 | |||
| 23 | return DigitoVerificador::checkCpfCnpjDigits($input); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function maskPattern(): string |
||
| 27 | { |
||
| 28 | return '/^[0-9]{3}\.[0-9]{3}\.[0-9]{3}\-[0-9]{2}$/'; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function unmaskedLength(): int |
||
| 32 | { |
||
| 33 | return 11; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function adjustZeroPadding(string $input): string |
||
| 39 | } |
||
| 40 | } |
||
| 41 |