@@ -22,7 +22,7 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $name = self::break($fullName); |
| 24 | 24 | |
| 25 | - if ($name['sobrenomes'] < 1) { |
|
| 25 | + if ($name['sobrenomes']<1) { |
|
| 26 | 26 | return false; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public static function toDatabase(string $number) |
| 15 | 15 | { |
| 16 | - if(strpos($number, ',') > 0) { |
|
| 16 | + if (strpos($number, ',')>0) { |
|
| 17 | 17 | $number = str_replace('.', '', $number); |
| 18 | 18 | $number = str_replace(',', '.', $number); |
| 19 | 19 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public static function isSame(string $to, string $from) |
| 34 | 34 | { |
| 35 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
| 35 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public static function validate($cep) |
| 24 | 24 | { |
| 25 | - if (preg_match('/[0-9]{2,2}([.]?)[0-9]{3,3}([- ]?)[0-9]{3}$/', $cep) == 0 ) { |
|
| 25 | + if (preg_match('/[0-9]{2,2}([.]?)[0-9]{3,3}([- ]?)[0-9]{3}$/', $cep) == 0) { |
|
| 26 | 26 | return false; |
| 27 | 27 | } |
| 28 | 28 | try { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public static function isSame(string $to, string $from) |
| 46 | 46 | { |
| 47 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
| 47 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | } |
@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | // Verify if Cpf is Valid || Calcula os digitos verificadores para verificar se o |
| 56 | 56 | // CPF é válido |
| 57 | - for ($t = 9; $t < 11; $t++) { |
|
| 57 | + for ($t = 9; $t<11; $t++) { |
|
| 58 | 58 | |
| 59 | - for ($d = 0, $c = 0; $c < $t; $c++) { |
|
| 60 | - $d += $cpf{$c} * (($t + 1) - $c); |
|
| 59 | + for ($d = 0, $c = 0; $c<$t; $c++) { |
|
| 60 | + $d += $cpf{$c} * (($t+1)-$c); |
|
| 61 | 61 | } |
| 62 | 62 | $d = ((10 * $d) % 11) % 10; |
| 63 | 63 | if ($cpf{$c} != $d) { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public static function isSame(string $to, string $from) |
| 79 | 79 | { |
| 80 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
| 80 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public static function isSame(string $fromDatabase, string $fromUser) |
| 82 | 82 | { |
| 83 | - return (self::toDatabase($fromDatabase)===self::toDatabase($fromUser)); |
|
| 83 | + return (self::toDatabase($fromDatabase) === self::toDatabase($fromUser)); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public static function generate( |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | $keyspace = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%' |
| 89 | 89 | ) { |
| 90 | 90 | $str = ''; |
| 91 | - $max = mb_strlen($keyspace, '8bit') - 1; |
|
| 92 | - if ($max < 1) { |
|
| 91 | + $max = mb_strlen($keyspace, '8bit')-1; |
|
| 92 | + if ($max<1) { |
|
| 93 | 93 | throw new Exception('$keyspace must be at least two characters long'); |
| 94 | 94 | } |
| 95 | - for ($i = 0; $i < $length; ++$i) { |
|
| 95 | + for ($i = 0; $i<$length; ++$i) { |
|
| 96 | 96 | $str .= $keyspace[random_int(0, $max)]; |
| 97 | 97 | } |
| 98 | 98 | return $str; |
@@ -9,15 +9,15 @@ |
||
| 9 | 9 | * @see https://wiki.php.net/rfc/splclassloader#example_implementation |
| 10 | 10 | */ |
| 11 | 11 | spl_autoload_register( |
| 12 | - function ($className) { |
|
| 12 | + function($className) { |
|
| 13 | 13 | $className = ltrim($className, '\\'); |
| 14 | 14 | $fileName = ''; |
| 15 | 15 | if ($lastNsPos = strripos($className, '\\')) { |
| 16 | 16 | $namespace = substr($className, 0, $lastNsPos); |
| 17 | - $className = substr($className, $lastNsPos + 1); |
|
| 18 | - $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; |
|
| 17 | + $className = substr($className, $lastNsPos+1); |
|
| 18 | + $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
|
| 19 | 19 | } |
| 20 | - $fileName = __DIR__ . DIRECTORY_SEPARATOR . $fileName . $className . '.php'; |
|
| 20 | + $fileName = __DIR__.DIRECTORY_SEPARATOR.$fileName.$className.'.php'; |
|
| 21 | 21 | if (file_exists($fileName)) { |
| 22 | 22 | include $fileName; |
| 23 | 23 | |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public static function toUser($gender) |
| 28 | 28 | { |
| 29 | - if($gender == 'M') { |
|
| 29 | + if ($gender == 'M') { |
|
| 30 | 30 | return 'Masculino'; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if($gender == 'F') { |
|
| 33 | + if ($gender == 'F') { |
|
| 34 | 34 | return 'Feminino'; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public static function isSame(string $to, string $from) |
| 52 | 52 | { |
| 53 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
| 53 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | public static function isSame(string $to, string $from) |
| 30 | 30 | { |
| 31 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
| 31 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | } |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | public static function validate($creditCardNumber) |
| 23 | 23 | { |
| 24 | 24 | $found = false; |
| 25 | - foreach (self::$cardParams as $masks){ |
|
| 26 | - foreach ($masks as $mask){ |
|
| 25 | + foreach (self::$cardParams as $masks) { |
|
| 26 | + foreach ($masks as $mask) { |
|
| 27 | 27 | if (self::maskIsValidate($creditCardNumber, $mask)) { |
| 28 | 28 | $found = true; |
| 29 | 29 | } |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public static function expirationIsValid($mes, $ano) |
| 36 | 36 | { |
| 37 | - if ((int) Date::yearToDatabase($ano) < (int) Carbon::now()->year) { |
|
| 37 | + if ((int) Date::yearToDatabase($ano)<(int) Carbon::now()->year) { |
|
| 38 | 38 | return false; |
| 39 | 39 | } |
| 40 | 40 | if ((int) Date::yearToDatabase($ano) == (int) Carbon::now()->year) { |
| 41 | - if ((int) Date::monthToDatabase($mes) < (int) Carbon::now()->month) { |
|
| 41 | + if ((int) Date::monthToDatabase($mes)<(int) Carbon::now()->month) { |
|
| 42 | 42 | return false; |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public static function isSame(string $to, string $from) |
| 59 | 59 | { |
| 60 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
| 60 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | } |