@@ -16,13 +16,13 @@ |
||
16 | 16 | if ($maskLen !== $numberLen) { |
17 | 17 | return false; |
18 | 18 | } |
19 | - while($i < $maskLen) { |
|
20 | - if (strtoupper($mask[$i])!=='X' && strtoupper($mask[$i])!=='#') { |
|
21 | - if ($mask[$i]!==$number[$i]) { |
|
19 | + while ($i<$maskLen) { |
|
20 | + if (strtoupper($mask[$i]) !== 'X' && strtoupper($mask[$i]) !== '#') { |
|
21 | + if ($mask[$i] !== $number[$i]) { |
|
22 | 22 | return false; |
23 | 23 | } |
24 | 24 | } |
25 | - $i = $i + 1; |
|
25 | + $i = $i+1; |
|
26 | 26 | } |
27 | 27 | return true; |
28 | 28 | } |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | { |
11 | 11 | $data = explode('/', $dataOriginal); |
12 | 12 | if (isset($data[2])) { |
13 | - if($data[1]>12) { |
|
14 | - return $data[2] .'-'. $data[0] .'-'. $data[1]; |
|
13 | + if ($data[1]>12) { |
|
14 | + return $data[2].'-'.$data[0].'-'.$data[1]; |
|
15 | 15 | } |
16 | - return $data[2] .'-'. $data[1] .'-'. $data[0]; |
|
16 | + return $data[2].'-'.$data[1].'-'.$data[0]; |
|
17 | 17 | } |
18 | 18 | return $dataOriginal; |
19 | 19 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | public static function isSame(string $to, string $from) |
74 | 74 | { |
75 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
75 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | } |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | public static function toDatabase(string $phone) |
9 | 9 | { |
10 | 10 | $phone = preg_replace('/[^0-9]/', '', $phone); |
11 | - if (substr((string) $phone, 0, 2)=='55') { |
|
11 | + if (substr((string) $phone, 0, 2) == '55') { |
|
12 | 12 | return $phone; |
13 | 13 | } |
14 | - if (empty($phone) || $phone=='55') { |
|
14 | + if (empty($phone) || $phone == '55') { |
|
15 | 15 | return null; |
16 | 16 | } |
17 | 17 | if (strlen($phone)>11) { |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | { |
30 | 30 | $phone = self::break($phoneNumber); |
31 | 31 | |
32 | - if ((int) $phone['country'] === 0 ) { |
|
32 | + if ((int) $phone['country'] === 0) { |
|
33 | 33 | return false; |
34 | 34 | } |
35 | 35 | |
36 | - if ((int) $phone['region'] === 0 ) { |
|
36 | + if ((int) $phone['region'] === 0) { |
|
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | |
40 | - if ((int) $phone['number'] === 0 ) { |
|
40 | + if ((int) $phone['number'] === 0) { |
|
41 | 41 | return false; |
42 | 42 | } |
43 | 43 | |
44 | - if (strlen(static::toDatabase($phoneNumber)) < 12 || strlen(static::toDatabase($phoneNumber)) > 13) { |
|
44 | + if (strlen(static::toDatabase($phoneNumber))<12 || strlen(static::toDatabase($phoneNumber))>13) { |
|
45 | 45 | return false; |
46 | 46 | } |
47 | 47 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | public static function isSame(string $to, string $from) |
72 | 72 | { |
73 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
73 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public static function isSame(string $to, string $from) |
33 | 33 | { |
34 | - return (self::toDatabase($to)===self::toDatabase($from)); |
|
34 | + return (self::toDatabase($to) === self::toDatabase($from)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public static function isMailto($link) |
154 | 154 | { |
155 | - if (stripos($link, 'mailto:')===false) { |
|
155 | + if (stripos($link, 'mailto:') === false) { |
|
156 | 156 | return false; |
157 | 157 | } else { |
158 | 158 | return true; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | if ($base === false) { |
250 | 250 | $base = ''; |
251 | 251 | } |
252 | - $r['path'] = $base . '/' . $r['path']; |
|
252 | + $r['path'] = $base.'/'.$r['path']; |
|
253 | 253 | } |
254 | 254 | $r['path'] = self::urlRemoveDotSegments($r['path']); |
255 | 255 | return self::joinUrl($r); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | } |
279 | 279 | $outPath = implode('/', $outSegs); |
280 | 280 | if ($path[0] == '/') { |
281 | - $outPath = '/' . $outPath; |
|
281 | + $outPath = '/'.$outPath; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // compare last multi-byte character against '/' |
@@ -297,17 +297,17 @@ discard block |
||
297 | 297 | * Inspired from code available at http://nadeausoftware.com/node/79, |
298 | 298 | * Code distributed under OSI BSD (http://www.opensource.org/licenses/bsd-license.php) |
299 | 299 | */ |
300 | - public static function splitUrl(string $url, $decode=true) |
|
300 | + public static function splitUrl(string $url, $decode = true) |
|
301 | 301 | { |
302 | 302 | $parts = []; |
303 | 303 | $m = []; |
304 | 304 | $xunressub = 'a-zA-Z\d\-._~\!$&\'()*+,;='; |
305 | - $xpchar = $xunressub . ':@%'; |
|
305 | + $xpchar = $xunressub.':@%'; |
|
306 | 306 | |
307 | 307 | $xscheme = '([a-zA-Z][a-zA-Z\d+-.]*)'; |
308 | 308 | |
309 | - $xuserinfo = '(([' . $xunressub . '%]*)' . |
|
310 | - '(:([' . $xunressub . ':%]*))?)'; |
|
309 | + $xuserinfo = '((['.$xunressub.'%]*)'. |
|
310 | + '(:(['.$xunressub.':%]*))?)'; |
|
311 | 311 | |
312 | 312 | $xipv4 = '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'; |
313 | 313 | |
@@ -316,31 +316,31 @@ discard block |
||
316 | 316 | $xhost_name = '([a-zA-Z%]+)'; |
317 | 317 | // $xhost_name = '([a-zA-Z\d-.%]+)'; @todo alterado pq tava dando erro nesse parser |
318 | 318 | |
319 | - $xhost = '(' . $xhost_name . '|' . $xipv4 . '|' . $xipv6 . ')'; |
|
319 | + $xhost = '('.$xhost_name.'|'.$xipv4.'|'.$xipv6.')'; |
|
320 | 320 | $xport = '(\d*)'; |
321 | - $xauthority = '((' . $xuserinfo . '@)?' . $xhost . |
|
322 | - '?(:' . $xport . ')?)'; |
|
321 | + $xauthority = '(('.$xuserinfo.'@)?'.$xhost. |
|
322 | + '?(:'.$xport.')?)'; |
|
323 | 323 | |
324 | - $xslash_seg = '(/[' . $xpchar . ']*)'; |
|
325 | - $xpath_authabs = '((//' . $xauthority . ')((/[' . $xpchar . ']*)*))'; |
|
326 | - $xpath_rel = '([' . $xpchar . ']+' . $xslash_seg . '*)'; |
|
327 | - $xpath_abs = '(/(' . $xpath_rel . ')?)'; |
|
328 | - $xapath = '(' . $xpath_authabs . '|' . $xpath_abs . |
|
329 | - '|' . $xpath_rel . ')'; |
|
324 | + $xslash_seg = '(/['.$xpchar.']*)'; |
|
325 | + $xpath_authabs = '((//'.$xauthority.')((/['.$xpchar.']*)*))'; |
|
326 | + $xpath_rel = '(['.$xpchar.']+'.$xslash_seg.'*)'; |
|
327 | + $xpath_abs = '(/('.$xpath_rel.')?)'; |
|
328 | + $xapath = '('.$xpath_authabs.'|'.$xpath_abs. |
|
329 | + '|'.$xpath_rel.')'; |
|
330 | 330 | |
331 | - $xqueryfrag = '([' . $xpchar . '/?' . ']*)'; |
|
331 | + $xqueryfrag = '(['.$xpchar.'/?'.']*)'; |
|
332 | 332 | |
333 | - $xurl = '^(' . $xscheme . ':)?' . $xapath . '?' . |
|
334 | - '(\?' . $xqueryfrag . ')?(#' . $xqueryfrag . ')?$'; |
|
333 | + $xurl = '^('.$xscheme.':)?'.$xapath.'?'. |
|
334 | + '(\?'.$xqueryfrag.')?(#'.$xqueryfrag.')?$'; |
|
335 | 335 | |
336 | 336 | |
337 | 337 | // Split the URL into components. |
338 | - if (!preg_match('!' . $xurl . '!', $url, $m)) { |
|
338 | + if (!preg_match('!'.$xurl.'!', $url, $m)) { |
|
339 | 339 | return false; |
340 | 340 | } |
341 | 341 | |
342 | 342 | if (!empty($m[2])) { |
343 | - $parts['scheme'] = strtolower($m[2]); |
|
343 | + $parts['scheme'] = strtolower($m[2]); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | if (!empty($m[7])) { |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | } |
352 | 352 | } |
353 | 353 | if (!empty($m[10])) { |
354 | - $parts['pass'] = $m[11]; |
|
354 | + $parts['pass'] = $m[11]; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | if (!empty($m[13])) { |
358 | - $h=$parts['host'] = $m[13]; |
|
358 | + $h = $parts['host'] = $m[13]; |
|
359 | 359 | } elseif (!empty($m[14])) { |
360 | 360 | $parts['host'] = $m[14]; |
361 | 361 | } elseif (!empty($m[16])) { |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $parts['query'] = $m[28]; |
380 | 380 | } |
381 | 381 | if (!empty($m[29])) { |
382 | - $parts['fragment']= $m[30]; |
|
382 | + $parts['fragment'] = $m[30]; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | if (!$decode) { |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * Inspired from code available at http://nadeausoftware.com/node/79, |
413 | 413 | * Code distributed under OSI BSD (http://www.opensource.org/licenses/bsd-license.php) |
414 | 414 | */ |
415 | - public static function joinUrl($parts, $encode=true) |
|
415 | + public static function joinUrl($parts, $encode = true) |
|
416 | 416 | { |
417 | 417 | if ($encode) { |
418 | 418 | if (isset($parts['user'])) { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | } |
436 | 436 | |
437 | 437 | if (isset($parts['query'])) { |
438 | - $parts['query'] = rawurlencode($parts['query']); |
|
438 | + $parts['query'] = rawurlencode($parts['query']); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | if (isset($parts['fragment'])) { |
@@ -445,25 +445,25 @@ discard block |
||
445 | 445 | |
446 | 446 | $url = ''; |
447 | 447 | if (!empty($parts['scheme'])) { |
448 | - $url .= $parts['scheme'] . ':'; |
|
448 | + $url .= $parts['scheme'].':'; |
|
449 | 449 | } |
450 | 450 | if (isset($parts['host'])) { |
451 | 451 | $url .= '//'; |
452 | 452 | if (isset($parts['user'])) { |
453 | 453 | $url .= $parts['user']; |
454 | 454 | if (isset($parts['pass'])) { |
455 | - $url .= ':' . $parts['pass']; |
|
455 | + $url .= ':'.$parts['pass']; |
|
456 | 456 | } |
457 | 457 | $url .= '@'; |
458 | 458 | } |
459 | 459 | if (preg_match('!^[\da-f]*:[\da-f.:]+$!ui', $parts['host'])) { |
460 | - $url .= '[' . $parts['host'] . ']'; |
|
460 | + $url .= '['.$parts['host'].']'; |
|
461 | 461 | } // IPv6 |
462 | 462 | else { |
463 | 463 | $url .= $parts['host']; |
464 | 464 | } // IPv4 or name |
465 | 465 | if (isset($parts['port'])) { |
466 | - $url .= ':' . $parts['port']; |
|
466 | + $url .= ':'.$parts['port']; |
|
467 | 467 | } |
468 | 468 | if (!empty($parts['path']) && $parts['path'][0] != '/') { |
469 | 469 | $url .= '/'; |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | $url .= $parts['path']; |
474 | 474 | } |
475 | 475 | if (isset($parts['query'])) { |
476 | - $url .= '?' . $parts['query']; |
|
476 | + $url .= '?'.$parts['query']; |
|
477 | 477 | } |
478 | 478 | if (isset($parts['fragment'])) { |
479 | - $url .= '#' . $parts['fragment']; |
|
479 | + $url .= '#'.$parts['fragment']; |
|
480 | 480 | } |
481 | 481 | return $url; |
482 | 482 | } |