Passed
Push — main ( bd8ab6...d7b565 )
by Breno
01:49
created

Cep::adjustZeroPadding()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace BrenoRoosevelt\Validation\Rules\Brazilian;
5
6
use Attribute;
7
8
#[Attribute(Attribute::TARGET_PROPERTY)]
9
class Cep extends Document
10
{
11
    public function __construct(bool $mask = true, ?string $message = 'CEP inválido')
12
    {
13
        parent::__construct($mask, $message);
14
    }
15
16
    protected function isValidDocument(string $input): bool
17
    {
18
        return $this->validateNumbersWithCorrectLength($input);
19
    }
20
21
    protected function adjustZeroPadding(string $input): string
22
    {
23
        return $input;
24
    }
25
26
    protected function maskPattern(): string
27
    {
28
        return '/^[0-9]{5}\-[0-9]{3}$/';
29
    }
30
31
    protected function unmaskedLength(): int
32
    {
33
        return 9;
34
    }
35
}
36