@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | public static function toDatabase(string $phone) |
12 | 12 | { |
13 | 13 | $phone = preg_replace('/[^0-9]/', '', $phone); |
14 | - if (substr((string) $phone,0,2)=='55') { |
|
14 | + if (substr((string) $phone, 0, 2) == '55') { |
|
15 | 15 | return $phone; |
16 | 16 | } |
17 | - if (empty($phone) || $phone=='55') { |
|
17 | + if (empty($phone) || $phone == '55') { |
|
18 | 18 | return null; |
19 | 19 | } |
20 | 20 | if (strlen($phone)>11) { |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | { |
33 | 33 | $phone = self::break($phone); |
34 | 34 | |
35 | - if ((int) $phone['country'] === 0 ) { |
|
35 | + if ((int) $phone['country'] === 0) { |
|
36 | 36 | return false; |
37 | 37 | } |
38 | 38 | |
39 | - if ((int) $phone['region'] === 0 ) { |
|
39 | + if ((int) $phone['region'] === 0) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | - if ((int) $phone['number'] === 0 ) { |
|
43 | + if ((int) $phone['number'] === 0) { |
|
44 | 44 | return false; |
45 | 45 | } |
46 | 46 | |
47 | - if (strlen(static::toDatabase($phone)) < 12 || strlen(static::toDatabase($phone)) > 13) { |
|
47 | + if (strlen(static::toDatabase($phone))<12 || strlen(static::toDatabase($phone))>13) { |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | public static function toDatabase($dataOriginal) |
14 | 14 | { |
15 | 15 | $data = explode('/', $dataOriginal); |
16 | - if (isset($data[2])){ |
|
17 | - if($data[1]>12){ |
|
18 | - return $data[2] .'-'. $data[0] .'-'. $data[1]; |
|
16 | + if (isset($data[2])) { |
|
17 | + if ($data[1]>12) { |
|
18 | + return $data[2].'-'.$data[0].'-'.$data[1]; |
|
19 | 19 | } |
20 | - return $data[2] .'-'. $data[1] .'-'. $data[0]; |
|
20 | + return $data[2].'-'.$data[1].'-'.$data[0]; |
|
21 | 21 | } |
22 | 22 | return $dataOriginal; |
23 | 23 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if ($year>99) { |
64 | 64 | return $year; |
65 | 65 | } |
66 | - if ($year>50){ |
|
66 | + if ($year>50) { |
|
67 | 67 | return 1900+$year; |
68 | 68 | } |
69 | 69 | return 2000+$year; |
@@ -13,7 +13,7 @@ |
||
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 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | public static function validate($birthdate) |
17 | 17 | { |
18 | - if (!parent::validate($birthdate)){ |
|
18 | + if (!parent::validate($birthdate)) { |
|
19 | 19 | return false; |
20 | 20 | } |
21 | 21 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public static function incluiInArray($field, $array) |
18 | 18 | { |
19 | 19 | foreach ($array as $notPermit) { |
20 | - if(strpos($field, $notPermit) !=0){ |
|
20 | + if (strpos($field, $notPermit) != 0) { |
|
21 | 21 | return true; |
22 | 22 | } |
23 | 23 | } |
@@ -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 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public static function toDatabase($gender) |
25 | 25 | { |
26 | - return substr(((string) self::filter(strtoupper(preg_replace('/[^A-z]/', '',$gender)))), 0, 1); |
|
26 | + return substr(((string) self::filter(strtoupper(preg_replace('/[^A-z]/', '', $gender)))), 0, 1); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public static function filter($gender) { |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | |
39 | 39 | public static function toUser($gender) |
40 | 40 | { |
41 | - if($gender == 'M') { |
|
41 | + if ($gender == 'M') { |
|
42 | 42 | return 'Masculino'; |
43 | 43 | } |
44 | 44 | |
45 | - if($gender == 'F') { |
|
45 | + if ($gender == 'F') { |
|
46 | 46 | return 'Feminino'; |
47 | 47 | } |
48 | 48 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public static function validate($email) |
101 | 101 | { |
102 | - if ((boolean) filter_var($email, FILTER_VALIDATE_EMAIL)===false){ |
|
102 | + if ((boolean) filter_var($email, FILTER_VALIDATE_EMAIL) === false) { |
|
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function setEmailFrom($email) { |
155 | 155 | if (!self::validate($email)) { |
156 | - $this->set_error('Invalid address : ' . $email); |
|
156 | + $this->set_error('Invalid address : '.$email); |
|
157 | 157 | $this->edebug($this->ErrorInfo); |
158 | 158 | if ($this->exceptions) { |
159 | 159 | throw new Exception($this->ErrorInfo); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param int $seconds |
168 | 168 | */ |
169 | 169 | public function setConnectionTimeout($seconds) { |
170 | - if ($seconds > 0) { |
|
170 | + if ($seconds>0) { |
|
171 | 171 | $this->max_connection_timeout = (int) $seconds; |
172 | 172 | } |
173 | 173 | } |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | * @param int $seconds |
178 | 178 | */ |
179 | 179 | public function setStreamTimeout($seconds) { |
180 | - if ($seconds > 0) { |
|
180 | + if ($seconds>0) { |
|
181 | 181 | $this->stream_timeout = (int) $seconds; |
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | 185 | public function setStreamTimeoutWait($seconds) { |
186 | - if ($seconds >= 0) { |
|
186 | + if ($seconds>=0) { |
|
187 | 187 | $this->stream_timeout_wait = (int) $seconds; |
188 | 188 | } |
189 | 189 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @return boolean True if an error did occur. |
243 | 243 | */ |
244 | 244 | public function isError() { |
245 | - return ($this->error_count > 0); |
|
245 | + return ($this->error_count>0); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | default: |
273 | 273 | //Normalize line breaks |
274 | 274 | $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
275 | - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
275 | + echo gmdate('Y-m-d H:i:s')."\t".str_replace( |
|
276 | 276 | "\n", "\n \t ", trim($str) |
277 | - ) . "\n"; |
|
277 | + )."\n"; |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * suppress error output from stream socket client... |
305 | 305 | * Thanks Michael. |
306 | 306 | */ |
307 | - $this->stream = @stream_socket_client("tcp://" . $host . ":" . $this->port, $errno, $errstr, $timeout); |
|
307 | + $this->stream = @stream_socket_client("tcp://".$host.":".$this->port, $errno, $errstr, $timeout); |
|
308 | 308 | if ($this->stream === FALSE) { |
309 | 309 | if ($errno == 0) { |
310 | 310 | $this->set_error("Problem initializing the socket"); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | } |
315 | 315 | return FALSE; |
316 | 316 | } else { |
317 | - $this->edebug($host . ":" . $errstr); |
|
317 | + $this->edebug($host.":".$errstr); |
|
318 | 318 | } |
319 | 319 | } else { |
320 | 320 | stream_set_timeout($this->stream, $this->stream_timeout); |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | return FALSE; |
340 | 340 | } |
341 | 341 | |
342 | - $this->_streamQuery("HELO " . self::parse_email($this->from)); |
|
342 | + $this->_streamQuery("HELO ".self::parse_email($this->from)); |
|
343 | 343 | $this->_streamResponse(); |
344 | 344 | $this->_streamQuery("MAIL FROM: <{$this->from}>"); |
345 | 345 | $this->_streamResponse(); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $this->_streamQuery("QUIT"); |
353 | 353 | fclose($this->stream); |
354 | 354 | |
355 | - $code = !empty($code2)?$code2:$code; |
|
355 | + $code = !empty($code2) ? $code2 : $code; |
|
356 | 356 | switch ($code) { |
357 | 357 | case '250': |
358 | 358 | /** |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | */ |
392 | 392 | protected function _streamQuery($query) { |
393 | 393 | $this->edebug($query); |
394 | - return stream_socket_sendto($this->stream, $query . self::CRLF); |
|
394 | + return stream_socket_sendto($this->stream, $query.self::CRLF); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
@@ -408,12 +408,12 @@ discard block |
||
408 | 408 | $this->edebug("Timed out while waiting for data! (timeout {$this->stream_timeout} seconds)"); |
409 | 409 | } |
410 | 410 | |
411 | - if ($reply === FALSE && $status['timed_out'] && $timed < $this->stream_timeout_wait) { |
|
412 | - return $this->_streamResponse($timed + $this->stream_timeout); |
|
411 | + if ($reply === FALSE && $status['timed_out'] && $timed<$this->stream_timeout_wait) { |
|
412 | + return $this->_streamResponse($timed+$this->stream_timeout); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | |
416 | - if ($reply !== FALSE && $status['unread_bytes'] > 0) { |
|
416 | + if ($reply !== FALSE && $status['unread_bytes']>0) { |
|
417 | 417 | $reply .= stream_get_line($this->stream, $status['unread_bytes'], self::CRLF); |
418 | 418 | } |
419 | 419 | $this->edebug($reply); |
@@ -7,15 +7,15 @@ |
||
7 | 7 | * Code inspired from the SplClassLoader RFC |
8 | 8 | * @see https://wiki.php.net/rfc/splclassloader#example_implementation |
9 | 9 | */ |
10 | -spl_autoload_register(function ($className) { |
|
10 | +spl_autoload_register(function($className) { |
|
11 | 11 | $className = ltrim($className, '\\'); |
12 | 12 | $fileName = ''; |
13 | 13 | if ($lastNsPos = strripos($className, '\\')) { |
14 | 14 | $namespace = substr($className, 0, $lastNsPos); |
15 | - $className = substr($className, $lastNsPos + 1); |
|
16 | - $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; |
|
15 | + $className = substr($className, $lastNsPos+1); |
|
16 | + $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
|
17 | 17 | } |
18 | - $fileName = __DIR__ . DIRECTORY_SEPARATOR . $fileName . $className . '.php'; |
|
18 | + $fileName = __DIR__.DIRECTORY_SEPARATOR.$fileName.$className.'.php'; |
|
19 | 19 | if (file_exists($fileName)) { |
20 | 20 | require $fileName; |
21 | 21 |