@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public static function setUpBeforeClass() |
19 | 19 | { |
20 | - $vendorDir = __DIR__ . '/../vendor'; |
|
21 | - $vendorAutoload = $vendorDir . '/autoload.php'; |
|
20 | + $vendorDir = __DIR__.'/../vendor'; |
|
21 | + $vendorAutoload = $vendorDir.'/autoload.php'; |
|
22 | 22 | if (file_exists($vendorAutoload)) { |
23 | 23 | require_once($vendorAutoload); |
24 | 24 | } else { |
25 | 25 | throw new NotSupportedException("Vendor autoload file '{$vendorAutoload}' is missing."); |
26 | 26 | } |
27 | - require_once($vendorDir . '/yiisoft/yii2/Yii.php'); |
|
27 | + require_once($vendorDir.'/yiisoft/yii2/Yii.php'); |
|
28 | 28 | Yii::setAlias('@vendor', $vendorDir); |
29 | 29 | } |
30 | 30 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'id' => 'testapp', |
38 | 38 | 'basePath' => __DIR__, |
39 | 39 | ]; |
40 | - $config['vendorPath'] = dirname(dirname(__DIR__)) . '/vendor'; |
|
40 | + $config['vendorPath'] = dirname(dirname(__DIR__)).'/vendor'; |
|
41 | 41 | new \yii\console\Application($config); |
42 | 42 | } |
43 | 43 |
@@ -5,12 +5,12 @@ |
||
5 | 5 | |
6 | 6 | define('YII_ENABLE_ERROR_HANDLER', false); |
7 | 7 | define('YII_DEBUG', true); |
8 | -$_SERVER['SCRIPT_NAME'] = '/' . __DIR__; |
|
8 | +$_SERVER['SCRIPT_NAME'] = '/'.__DIR__; |
|
9 | 9 | $_SERVER['SCRIPT_FILENAME'] = __FILE__; |
10 | 10 | |
11 | 11 | // require composer autoloader if available |
12 | -$vendor = __DIR__ . '/../vendor'; |
|
12 | +$vendor = __DIR__.'/../vendor'; |
|
13 | 13 | |
14 | -require_once($vendor . '/autoload.php'); |
|
15 | -require_once($vendor . '/yiisoft/yii2/Yii.php'); |
|
16 | -require_once(__DIR__ . '/TestCase.php'); |
|
14 | +require_once($vendor.'/autoload.php'); |
|
15 | +require_once($vendor.'/yiisoft/yii2/Yii.php'); |
|
16 | +require_once(__DIR__.'/TestCase.php'); |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | protected function validateValue($value) |
37 | 37 | { |
38 | 38 | $cei = preg_replace('/[^0-9_]/', '', $value); |
39 | - $valid = strlen($cei) == 12; |
|
39 | + $valid = strlen($cei) == 12; |
|
40 | 40 | |
41 | 41 | if ($valid) { |
42 | 42 | $cei = str_split($cei, 1); |
43 | 43 | $sum = (7 * $cei[0]) + (4 * $cei[1]) + (1 * $cei[2]) + (8 * $cei[3]) + (5 * $cei[4]) + (2 * $cei[5]) + |
44 | 44 | (1 * $cei[6]) + (6 * $cei[7]) + (3 * $cei[8]) + (7 * $cei[9]) + (4 * $cei[10]); |
45 | 45 | |
46 | - $dv = abs(10 - ($sum%10 + $sum/10) % 10); |
|
46 | + $dv = abs(10 - ($sum % 10 + $sum / 10) % 10); |
|
47 | 47 | $valid = ($cei[11] == $dv); |
48 | 48 | } |
49 | 49 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | ValidationAsset::register($view); |
69 | - return 'yiibr.validation.cei(value, messages, ' . Json::encode($options) . ');'; |
|
69 | + return 'yiibr.validation.cei(value, messages, '.Json::encode($options).');'; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | } |
@@ -35,22 +35,22 @@ discard block |
||
35 | 35 | $valid = true; |
36 | 36 | $cnpj = preg_replace('/[^0-9_]/', '', $value); |
37 | 37 | |
38 | - for ($x=0; $x<10; $x++) { |
|
39 | - if ( $cnpj == str_repeat($x, 14) ) { |
|
38 | + for ($x = 0; $x < 10; $x++) { |
|
39 | + if ($cnpj == str_repeat($x, 14)) { |
|
40 | 40 | $valid = false; |
41 | 41 | } |
42 | 42 | } |
43 | 43 | if ($valid) { |
44 | 44 | if (strlen($cnpj) != 14) { |
45 | 45 | $valid = false; |
46 | - } else { |
|
47 | - for ($t = 12; $t < 14; $t ++) { |
|
46 | + } else { |
|
47 | + for ($t = 12; $t < 14; $t++) { |
|
48 | 48 | $d = 0; |
49 | 49 | $c = 0; |
50 | - for ($m = $t - 7; $m >= 2; $m --, $c ++) { |
|
50 | + for ($m = $t - 7; $m >= 2; $m--, $c++) { |
|
51 | 51 | $d += $cnpj[$c] * $m; |
52 | 52 | } |
53 | - for ($m = 9; $m >= 2; $m --, $c ++) { |
|
53 | + for ($m = 9; $m >= 2; $m--, $c++) { |
|
54 | 54 | $d += $cnpj[$c] * $m; |
55 | 55 | } |
56 | 56 | $d = ((10 * $d) % 11) % 10; |
@@ -77,6 +77,6 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | ValidationAsset::register($view); |
80 | - return 'yiibr.validation.cnpj(value, messages, ' . Json::encode($options) . ');'; |
|
80 | + return 'yiibr.validation.cnpj(value, messages, '.Json::encode($options).');'; |
|
81 | 81 | } |
82 | 82 | } |
@@ -35,18 +35,18 @@ discard block |
||
35 | 35 | $valid = true; |
36 | 36 | $cpf = preg_replace('/[^0-9]/', '', $value); |
37 | 37 | |
38 | - for($x = 0; $x < 10; $x ++) { |
|
39 | - if ($cpf == str_repeat ( $x, 11 )) { |
|
38 | + for ($x = 0; $x < 10; $x++) { |
|
39 | + if ($cpf == str_repeat($x, 11)) { |
|
40 | 40 | $valid = false; |
41 | 41 | } |
42 | 42 | } |
43 | 43 | if ($valid) { |
44 | - if (strlen ( $cpf ) != 11) { |
|
44 | + if (strlen($cpf) != 11) { |
|
45 | 45 | $valid = false; |
46 | 46 | } else { |
47 | - for ($t = 9; $t < 11; $t ++) { |
|
47 | + for ($t = 9; $t < 11; $t++) { |
|
48 | 48 | $d = 0; |
49 | - for($c = 0; $c < $t; $c ++) { |
|
49 | + for ($c = 0; $c < $t; $c++) { |
|
50 | 50 | $d += $cpf[$c] * (($t + 1) - $c); |
51 | 51 | } |
52 | 52 | $d = ((10 * $d) % 11) % 10; |
@@ -76,6 +76,6 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | ValidationAsset::register($view); |
79 | - return 'yiibr.validation.cpf(value, messages, ' . Json::encode($options) . ');'; |
|
79 | + return 'yiibr.validation.cpf(value, messages, '.Json::encode($options).');'; |
|
80 | 80 | } |
81 | 81 | } |