@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | public static function isSame(string $to, string $from) |
| 96 | 96 | { |
| 97 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
| 97 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public static function validate($email) |
| 106 | 106 | { |
| 107 | - if ((boolean) filter_var($email, FILTER_VALIDATE_EMAIL)===false){ |
|
| 107 | + if ((boolean) filter_var($email, FILTER_VALIDATE_EMAIL) === false) { |
|
| 108 | 108 | return false; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $emailAddresse[0], |
| 121 | 121 | self::getListFromFile('black-first-names') |
| 122 | 122 | ], |
| 123 | - ])){ |
|
| 123 | + ])) { |
|
| 124 | 124 | return false; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function setEmailFrom($email) { |
| 166 | 166 | if (!self::validate($email)) { |
| 167 | - $this->set_error('Invalid address : ' . $email); |
|
| 167 | + $this->set_error('Invalid address : '.$email); |
|
| 168 | 168 | $this->edebug($this->ErrorInfo); |
| 169 | 169 | if ($this->exceptions) { |
| 170 | 170 | throw new Exception($this->ErrorInfo); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param int $seconds |
| 179 | 179 | */ |
| 180 | 180 | public function setConnectionTimeout($seconds) { |
| 181 | - if ($seconds > 0) { |
|
| 181 | + if ($seconds>0) { |
|
| 182 | 182 | $this->max_connection_timeout = (int) $seconds; |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -188,13 +188,13 @@ discard block |
||
| 188 | 188 | * @param int $seconds |
| 189 | 189 | */ |
| 190 | 190 | public function setStreamTimeout($seconds) { |
| 191 | - if ($seconds > 0) { |
|
| 191 | + if ($seconds>0) { |
|
| 192 | 192 | $this->stream_timeout = (int) $seconds; |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | public function setStreamTimeoutWait($seconds) { |
| 197 | - if ($seconds >= 0) { |
|
| 197 | + if ($seconds>=0) { |
|
| 198 | 198 | $this->stream_timeout_wait = (int) $seconds; |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @return boolean True if an error did occur. |
| 254 | 254 | */ |
| 255 | 255 | public function isError() { |
| 256 | - return ($this->error_count > 0); |
|
| 256 | + return ($this->error_count>0); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
@@ -283,9 +283,9 @@ discard block |
||
| 283 | 283 | default: |
| 284 | 284 | //Normalize line breaks |
| 285 | 285 | $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
| 286 | - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
| 286 | + echo gmdate('Y-m-d H:i:s')."\t".str_replace( |
|
| 287 | 287 | "\n", "\n \t ", trim($str) |
| 288 | - ) . "\n"; |
|
| 288 | + )."\n"; |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * suppress error output from stream socket client... |
| 316 | 316 | * Thanks Michael. |
| 317 | 317 | */ |
| 318 | - $this->stream = @stream_socket_client("tcp://" . $host . ":" . $this->port, $errno, $errstr, $timeout); |
|
| 318 | + $this->stream = @stream_socket_client("tcp://".$host.":".$this->port, $errno, $errstr, $timeout); |
|
| 319 | 319 | if ($this->stream === FALSE) { |
| 320 | 320 | if ($errno == 0) { |
| 321 | 321 | $this->set_error("Problem initializing the socket"); |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | } |
| 326 | 326 | return FALSE; |
| 327 | 327 | } else { |
| 328 | - $this->edebug($host . ":" . $errstr); |
|
| 328 | + $this->edebug($host.":".$errstr); |
|
| 329 | 329 | } |
| 330 | 330 | } else { |
| 331 | 331 | stream_set_timeout($this->stream, $this->stream_timeout); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | return FALSE; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - $this->_streamQuery("HELO " . self::parse_email($this->from)); |
|
| 353 | + $this->_streamQuery("HELO ".self::parse_email($this->from)); |
|
| 354 | 354 | $this->_streamResponse(); |
| 355 | 355 | $this->_streamQuery("MAIL FROM: <{$this->from}>"); |
| 356 | 356 | $this->_streamResponse(); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $this->_streamQuery("QUIT"); |
| 364 | 364 | fclose($this->stream); |
| 365 | 365 | |
| 366 | - $code = !empty($code2)?$code2:$code; |
|
| 366 | + $code = !empty($code2) ? $code2 : $code; |
|
| 367 | 367 | switch ($code) { |
| 368 | 368 | case '250': |
| 369 | 369 | /** |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | protected function _streamQuery($query) { |
| 404 | 404 | $this->edebug($query); |
| 405 | - return stream_socket_sendto($this->stream, $query . self::CRLF); |
|
| 405 | + return stream_socket_sendto($this->stream, $query.self::CRLF); |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | /** |
@@ -419,12 +419,12 @@ discard block |
||
| 419 | 419 | $this->edebug("Timed out while waiting for data! (timeout {$this->stream_timeout} seconds)"); |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - if ($reply === FALSE && $status['timed_out'] && $timed < $this->stream_timeout_wait) { |
|
| 423 | - return $this->_streamResponse($timed + $this->stream_timeout); |
|
| 422 | + if ($reply === FALSE && $status['timed_out'] && $timed<$this->stream_timeout_wait) { |
|
| 423 | + return $this->_streamResponse($timed+$this->stream_timeout); |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | |
| 427 | - if ($reply !== FALSE && $status['unread_bytes'] > 0) { |
|
| 427 | + if ($reply !== FALSE && $status['unread_bytes']>0) { |
|
| 428 | 428 | $reply .= stream_get_line($this->stream, $status['unread_bytes'], self::CRLF); |
| 429 | 429 | } |
| 430 | 430 | $this->edebug($reply); |
@@ -52,8 +52,8 @@ |
||
| 52 | 52 | return false; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - // Verify if Cpf is Valid || Calcula os digitos verificadores para verificar se o |
|
| 56 | - // CPF é válido |
|
| 55 | + // Verify if Cpf is Valid || Calcula os digitos verificadores para verificar se o |
|
| 56 | + // CPF é válido |
|
| 57 | 57 | for ($t = 9; $t < 11; $t++) { |
| 58 | 58 | |
| 59 | 59 | for ($d = 0, $c = 0; $c < $t; $c++) { |
@@ -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 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | $name = self::break($fullName); |
| 25 | 25 | |
| 26 | - if ($name['sobrenomes'] < 1) { |
|
| 26 | + if ($name['sobrenomes']<1) { |
|
| 27 | 27 | return false; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $name['first'], |
| 37 | 37 | self::getListFromFile('black-first-names') |
| 38 | 38 | ], |
| 39 | - ])){ |
|
| 39 | + ])) { |
|
| 40 | 40 | return false; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $fileHandle = fopen(self::getFileUrl($file), "r"); |
| 44 | 44 | while (!feof($fileHandle)) { |
| 45 | - if (trim($string) === trim(fgets($fileHandle))){ |
|
| 45 | + if (trim($string) === trim(fgets($fileHandle))) { |
|
| 46 | 46 | return true; |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | public static function foundInArray($field, $array) |
| 34 | 34 | { |
| 35 | 35 | foreach ($array as $notPermit) { |
| 36 | - if(strpos($field, $notPermit) !== false){ |
|
| 36 | + if (strpos($field, $notPermit) !== false) { |
|
| 37 | 37 | return true; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $password, |
| 65 | 65 | self::getListFromFile('black-first-names') |
| 66 | 66 | ], |
| 67 | - ])){ |
|
| 67 | + ])) { |
|
| 68 | 68 | return false; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -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 | |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | $keyspace = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%' |
| 90 | 90 | ) { |
| 91 | 91 | $str = ''; |
| 92 | - $max = mb_strlen($keyspace, '8bit') - 1; |
|
| 93 | - if ($max < 1) { |
|
| 92 | + $max = mb_strlen($keyspace, '8bit')-1; |
|
| 93 | + if ($max<1) { |
|
| 94 | 94 | throw new Exception('$keyspace must be at least two characters long'); |
| 95 | 95 | } |
| 96 | - for ($i = 0; $i < $length; ++$i) { |
|
| 96 | + for ($i = 0; $i<$length; ++$i) { |
|
| 97 | 97 | $str .= $keyspace[random_int(0, $max)]; |
| 98 | 98 | } |
| 99 | 99 | return $str; |