Code Duplication    Length = 5-5 lines in 2 locations

src/CnpjValidator.php 1 location

@@ 38-42 (lines=5) @@
35
        $valid = true;
36
        $cnpj = preg_replace('/[^0-9_]/', '', $value);
37
38
        for ($x=0; $x<10; $x++) {
39
            if ( $cnpj == str_repeat($x, 14) ) {
40
                $valid = false;
41
            }
42
        }
43
        if ($valid) {
44
            if (strlen($cnpj) != 14) {
45
                $valid = false;

src/CpfValidator.php 1 location

@@ 38-42 (lines=5) @@
35
        $valid = true;
36
        $cpf = preg_replace('/[^0-9]/', '', $value);
37
38
        for($x = 0; $x < 10; $x ++) {
39
            if ($cpf == str_repeat ( $x, 11 )) {
40
                $valid = false;
41
            }
42
        }
43
        if ($valid) {
44
            if (strlen ( $cpf ) != 11) {
45
                $valid = false;