@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -312,28 +312,28 @@ discard block |
||
312 | 312 | return; |
313 | 313 | } |
314 | 314 | switch ($this->Debugoutput) { |
315 | - case 'log': |
|
316 | - //Don't output, just log |
|
317 | - error_log($str); |
|
318 | - break; |
|
319 | - case 'html': |
|
320 | - //Cleans up output a bit for a better looking, HTML-safe output |
|
321 | - echo htmlentities( |
|
322 | - preg_replace('/[\r\n]+/', '', $str), |
|
323 | - ENT_QUOTES, |
|
324 | - 'UTF-8' |
|
325 | - ) |
|
326 | - . "<br>\n"; |
|
327 | - break; |
|
328 | - case 'echo': |
|
329 | - default: |
|
330 | - //Normalize line breaks |
|
331 | - $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
|
332 | - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
333 | - "\n", |
|
334 | - "\n \t ", |
|
335 | - trim($str) |
|
336 | - ) . "\n"; |
|
315 | + case 'log': |
|
316 | + //Don't output, just log |
|
317 | + error_log($str); |
|
318 | + break; |
|
319 | + case 'html': |
|
320 | + //Cleans up output a bit for a better looking, HTML-safe output |
|
321 | + echo htmlentities( |
|
322 | + preg_replace('/[\r\n]+/', '', $str), |
|
323 | + ENT_QUOTES, |
|
324 | + 'UTF-8' |
|
325 | + ) |
|
326 | + . "<br>\n"; |
|
327 | + break; |
|
328 | + case 'echo': |
|
329 | + default: |
|
330 | + //Normalize line breaks |
|
331 | + $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
|
332 | + echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
333 | + "\n", |
|
334 | + "\n \t ", |
|
335 | + trim($str) |
|
336 | + ) . "\n"; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
@@ -415,17 +415,17 @@ discard block |
||
415 | 415 | |
416 | 416 | $code = !empty($code2)?$code2:$code; |
417 | 417 | switch ($code) { |
418 | - case '250': |
|
419 | - /** |
|
418 | + case '250': |
|
419 | + /** |
|
420 | 420 | * http://www.ietf.org/rfc/rfc0821.txt |
421 | 421 | * 250 Requested mail action okay, completed |
422 | 422 | * email address was accepted |
423 | 423 | */ |
424 | - // no break |
|
425 | - case '450': |
|
426 | - case '451': |
|
427 | - case '452': |
|
428 | - /** |
|
424 | + // no break |
|
425 | + case '450': |
|
426 | + case '451': |
|
427 | + case '452': |
|
428 | + /** |
|
429 | 429 | * http://www.ietf.org/rfc/rfc0821.txt |
430 | 430 | * 450 Requested action not taken: the remote mail server |
431 | 431 | * does not want to accept mail from your server for |
@@ -436,11 +436,11 @@ discard block |
||
436 | 436 | * email address was greylisted (or some temporary error occured on the MTA) |
437 | 437 | * i believe that e-mail exists |
438 | 438 | */ |
439 | - return true; |
|
440 | - case '550': |
|
441 | - return false; |
|
442 | - default: |
|
443 | - return false; |
|
439 | + return true; |
|
440 | + case '550': |
|
441 | + return false; |
|
442 | + default: |
|
443 | + return false; |
|
444 | 444 | } |
445 | 445 | } |
446 | 446 |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | public static function isSame(string $to, string $from) |
108 | 108 | { |
109 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
109 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public static function validate(string $email): boolean |
119 | 119 | { |
120 | - if ((boolean) filter_var($email, FILTER_VALIDATE_EMAIL)===false) { |
|
120 | + if ((boolean) filter_var($email, FILTER_VALIDATE_EMAIL) === false) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | public function setEmailFrom(string $email): void |
193 | 193 | { |
194 | 194 | if (!self::validate($email)) { |
195 | - $this->set_error('Invalid address : ' . $email); |
|
195 | + $this->set_error('Invalid address : '.$email); |
|
196 | 196 | $this->edebug($this->ErrorInfo); |
197 | 197 | if ($this->exceptions) { |
198 | 198 | throw new Exception($this->ErrorInfo); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function setConnectionTimeout($seconds): void |
210 | 210 | { |
211 | - if ($seconds > 0) { |
|
211 | + if ($seconds>0) { |
|
212 | 212 | $this->max_connection_timeout = (int) $seconds; |
213 | 213 | } |
214 | 214 | } |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function setStreamTimeout($seconds): void |
222 | 222 | { |
223 | - if ($seconds > 0) { |
|
223 | + if ($seconds>0) { |
|
224 | 224 | $this->stream_timeout = (int) $seconds; |
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | 228 | public function setStreamTimeoutWait($seconds): void |
229 | 229 | { |
230 | - if ($seconds >= 0) { |
|
230 | + if ($seconds>=0) { |
|
231 | 231 | $this->stream_timeout_wait = (int) $seconds; |
232 | 232 | } |
233 | 233 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public function isError(): boolean |
297 | 297 | { |
298 | - return ($this->error_count > 0); |
|
298 | + return ($this->error_count>0); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -329,11 +329,11 @@ discard block |
||
329 | 329 | default: |
330 | 330 | //Normalize line breaks |
331 | 331 | $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
332 | - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
332 | + echo gmdate('Y-m-d H:i:s')."\t".str_replace( |
|
333 | 333 | "\n", |
334 | 334 | "\n \t ", |
335 | 335 | trim($str) |
336 | - ) . "\n"; |
|
336 | + )."\n"; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * suppress error output from stream socket client... |
366 | 366 | * Thanks Michael. |
367 | 367 | */ |
368 | - $this->stream = @stream_socket_client("tcp://" . $host . ":" . $this->port, $errno, $errstr, $timeout); |
|
368 | + $this->stream = @stream_socket_client("tcp://".$host.":".$this->port, $errno, $errstr, $timeout); |
|
369 | 369 | if ($this->stream === false) { |
370 | 370 | if ($errno == 0) { |
371 | 371 | $this->set_error("Problem initializing the socket"); |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | } |
376 | 376 | return false; |
377 | 377 | } else { |
378 | - $this->edebug($host . ":" . $errstr); |
|
378 | + $this->edebug($host.":".$errstr); |
|
379 | 379 | } |
380 | 380 | } else { |
381 | 381 | stream_set_timeout($this->stream, $this->stream_timeout); |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | return false; |
401 | 401 | } |
402 | 402 | |
403 | - $this->_streamQuery("HELO " . self::parse_email($this->from)); |
|
403 | + $this->_streamQuery("HELO ".self::parse_email($this->from)); |
|
404 | 404 | $this->_streamResponse(); |
405 | 405 | $this->_streamQuery("MAIL FROM: <{$this->from}>"); |
406 | 406 | $this->_streamResponse(); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $this->_streamQuery("QUIT"); |
414 | 414 | fclose($this->stream); |
415 | 415 | |
416 | - $code = !empty($code2)?$code2:$code; |
|
416 | + $code = !empty($code2) ? $code2 : $code; |
|
417 | 417 | switch ($code) { |
418 | 418 | case '250': |
419 | 419 | /** |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | protected function _streamQuery(string $query) |
456 | 456 | { |
457 | 457 | $this->edebug($query); |
458 | - return stream_socket_sendto($this->stream, $query . self::CRLF); |
|
458 | + return stream_socket_sendto($this->stream, $query.self::CRLF); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | $this->edebug("Timed out while waiting for data! (timeout {$this->stream_timeout} seconds)"); |
475 | 475 | } |
476 | 476 | |
477 | - if ($reply === false && $status['timed_out'] && $timed < $this->stream_timeout_wait) { |
|
478 | - return $this->_streamResponse($timed + $this->stream_timeout); |
|
477 | + if ($reply === false && $status['timed_out'] && $timed<$this->stream_timeout_wait) { |
|
478 | + return $this->_streamResponse($timed+$this->stream_timeout); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
482 | - if ($reply !== false && $status['unread_bytes'] > 0) { |
|
482 | + if ($reply !== false && $status['unread_bytes']>0) { |
|
483 | 483 | $reply .= stream_get_line($this->stream, $status['unread_bytes'], self::CRLF); |
484 | 484 | } |
485 | 485 | $this->edebug($reply); |
@@ -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 | } |