@@ -35,20 +35,20 @@ discard block |
||
35 | 35 | $valid = true; |
36 | 36 | $cpfCnpj = preg_replace('/[^0-9]/', '', $value); |
37 | 37 | |
38 | - for ($x=0; $x<10; $x++) { |
|
39 | - if ( $cpfCnpj == str_repeat($x, 11) || $cpfCnpj == str_repeat($x, 14) ) { |
|
38 | + for ($x = 0; $x < 10; $x++) { |
|
39 | + if ($cpfCnpj == str_repeat($x, 11) || $cpfCnpj == str_repeat($x, 14)) { |
|
40 | 40 | $valid = false; |
41 | 41 | } |
42 | 42 | } |
43 | 43 | if ($valid) { |
44 | 44 | if (strlen($cpfCnpj) === 14) { |
45 | - for ($t = 12; $t < 14; $t ++) { |
|
45 | + for ($t = 12; $t < 14; $t++) { |
|
46 | 46 | $d = 0; |
47 | 47 | $c = 0; |
48 | - for ($m = $t - 7; $m >= 2; $m --, $c ++) { |
|
48 | + for ($m = $t - 7; $m >= 2; $m--, $c++) { |
|
49 | 49 | $d += $cpfCnpj [$c] * $m; |
50 | 50 | } |
51 | - for ($m = 9; $m >= 2; $m --, $c ++) { |
|
51 | + for ($m = 9; $m >= 2; $m--, $c++) { |
|
52 | 52 | $d += $cpfCnpj [$c] * $m; |
53 | 53 | } |
54 | 54 | $d = ((10 * $d) % 11) % 10; |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | } |
59 | 59 | } |
60 | 60 | } else if (strlen($cpfCnpj) === 11) { |
61 | - for ($t = 9; $t < 11; $t ++) { |
|
61 | + for ($t = 9; $t < 11; $t++) { |
|
62 | 62 | $d = 0; |
63 | - for($c = 0; $c < $t; $c ++) { |
|
63 | + for ($c = 0; $c < $t; $c++) { |
|
64 | 64 | $d += $cpfCnpj [$c] * (($t + 1) - $c); |
65 | 65 | } |
66 | 66 | $d = ((10 * $d) % 11) % 10; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | break; |
70 | 70 | } |
71 | 71 | } |
72 | - } else { |
|
72 | + } else { |
|
73 | 73 | $valid = false; |
74 | 74 | } |
75 | 75 | } |
@@ -89,6 +89,6 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | ValidationAsset::register($view); |
92 | - return 'yiibr.validation.cpfCnpj(value, messages, ' . Json::encode($options) . ');'; |
|
92 | + return 'yiibr.validation.cpfCnpj(value, messages, '.Json::encode($options).');'; |
|
93 | 93 | } |
94 | 94 | } |