Test Failed
Push — master ( 589df8...b16e53 )
by Ricardo
02:16
created
src/Validate/Email.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
     public static function isSame(string $to, string $from)
97 97
     {
98
-        return (self::toDatabase($to)===self::toDatabase($from));
98
+        return (self::toDatabase($to) === self::toDatabase($from));
99 99
     }
100 100
 
101 101
     /**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public static function validate(string $email): boolean
107 107
     {
108
-        if ((boolean) filter_var($email, FILTER_VALIDATE_EMAIL)===false) {
108
+        if ((boolean) filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
109 109
             return false;
110 110
         }
111 111
         
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     public function setEmailFrom(string $email): void
174 174
     {
175 175
         if (!self::validate($email)) {
176
-            $this->set_error('Invalid address : ' . $email);
176
+            $this->set_error('Invalid address : '.$email);
177 177
             $this->edebug($this->ErrorInfo);
178 178
             if ($this->exceptions) {
179 179
                 throw new Exception($this->ErrorInfo);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     public function setConnectionTimeout($seconds): void
190 190
     {
191
-        if ($seconds > 0) {
191
+        if ($seconds>0) {
192 192
             $this->max_connection_timeout = (int) $seconds;
193 193
         }
194 194
     }
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
      */
200 200
     public function setStreamTimeout($seconds): void
201 201
     {
202
-        if ($seconds > 0) {
202
+        if ($seconds>0) {
203 203
             $this->stream_timeout = (int) $seconds;
204 204
         }
205 205
     }
206 206
 
207 207
     public function setStreamTimeoutWait($seconds): void
208 208
     {
209
-        if ($seconds >= 0) {
209
+        if ($seconds>=0) {
210 210
             $this->stream_timeout_wait = (int) $seconds;
211 211
         }
212 212
     }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      */
270 270
     public function isError(): boolean
271 271
     {
272
-        return ($this->error_count > 0);
272
+        return ($this->error_count>0);
273 273
     }
274 274
 
275 275
     /**
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
             default:
303 303
                 //Normalize line breaks
304 304
                 $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
305
-                echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
305
+                echo gmdate('Y-m-d H:i:s')."\t".str_replace(
306 306
                     "\n",
307 307
                     "\n \t ",
308 308
                     trim($str)
309
-                ) . "\n";
309
+                )."\n";
310 310
         }
311 311
     }
312 312
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
              * suppress error output from stream socket client...
338 338
              * Thanks Michael.
339 339
              */
340
-            $this->stream = @stream_socket_client("tcp://" . $host . ":" . $this->port, $errno, $errstr, $timeout);
340
+            $this->stream = @stream_socket_client("tcp://".$host.":".$this->port, $errno, $errstr, $timeout);
341 341
             if ($this->stream === false) {
342 342
                 if ($errno == 0) {
343 343
                     $this->set_error("Problem initializing the socket");
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                     }
348 348
                     return false;
349 349
                 } else {
350
-                    $this->edebug($host . ":" . $errstr);
350
+                    $this->edebug($host.":".$errstr);
351 351
                 }
352 352
             } else {
353 353
                 stream_set_timeout($this->stream, $this->stream_timeout);
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             return false;
373 373
         }
374 374
 
375
-        $this->_streamQuery("HELO " . self::parse_email($this->from));
375
+        $this->_streamQuery("HELO ".self::parse_email($this->from));
376 376
         $this->_streamResponse();
377 377
         $this->_streamQuery("MAIL FROM: <{$this->from}>");
378 378
         $this->_streamResponse();
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
         $this->_streamQuery("QUIT");
386 386
         fclose($this->stream);
387 387
         
388
-        $code = !empty($code2)?$code2:$code;
388
+        $code = !empty($code2) ? $code2 : $code;
389 389
         switch ($code) {
390 390
             case '250':
391 391
             /**
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
     protected function _streamQuery($query)
427 427
     {
428 428
         $this->edebug($query);
429
-        return stream_socket_sendto($this->stream, $query . self::CRLF);
429
+        return stream_socket_sendto($this->stream, $query.self::CRLF);
430 430
     }
431 431
 
432 432
     /**
@@ -444,12 +444,12 @@  discard block
 block discarded – undo
444 444
             $this->edebug("Timed out while waiting for data! (timeout {$this->stream_timeout} seconds)");
445 445
         }
446 446
 
447
-        if ($reply === false && $status['timed_out'] && $timed < $this->stream_timeout_wait) {
448
-            return $this->_streamResponse($timed + $this->stream_timeout);
447
+        if ($reply === false && $status['timed_out'] && $timed<$this->stream_timeout_wait) {
448
+            return $this->_streamResponse($timed+$this->stream_timeout);
449 449
         }
450 450
 
451 451
 
452
-        if ($reply !== false && $status['unread_bytes'] > 0) {
452
+        if ($reply !== false && $status['unread_bytes']>0) {
453 453
             $reply .= stream_get_line($this->stream, $status['unread_bytes'], self::CRLF);
454 454
         }
455 455
         $this->edebug($reply);
Please login to merge, or discard this patch.
src/Validate/Password.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Validate/Url.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         }
280 280
         $outPath = implode('/', $outSegs);
281 281
         if ($path[0] == '/') {
282
-            $outPath = '/' . $outPath;
282
+            $outPath = '/'.$outPath;
283 283
         }
284 284
 
285 285
         // compare last multi-byte character against '/'
@@ -298,17 +298,17 @@  discard block
 block discarded – undo
298 298
      * Code distributed under OSI BSD (http://www.opensource.org/licenses/bsd-license.php)
299 299
      *
300 300
      */
301
-    public static function splitUrl($url, $decode=true)
301
+    public static function splitUrl($url, $decode = true)
302 302
     {
303 303
         $parts = [];
304 304
         $m = [];
305 305
         $xunressub     = 'a-zA-Z\d\-._~\!$&\'()*+,;=';
306
-        $xpchar        = $xunressub . ':@%';
306
+        $xpchar        = $xunressub.':@%';
307 307
 
308 308
         $xscheme       = '([a-zA-Z][a-zA-Z\d+-.]*)';
309 309
 
310
-        $xuserinfo     = '((['  . $xunressub . '%]*)' .
311
-                        '(:([' . $xunressub . ':%]*))?)';
310
+        $xuserinfo     = '((['.$xunressub.'%]*)'.
311
+                        '(:(['.$xunressub.':%]*))?)';
312 312
 
313 313
         $xipv4         = '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})';
314 314
 
@@ -317,31 +317,31 @@  discard block
 block discarded – undo
317 317
         $xhost_name    = '([a-zA-Z%]+)';
318 318
         // $xhost_name    = '([a-zA-Z\d-.%]+)'; @todo alterado pq tava dando erro nesse parser
319 319
 
320
-        $xhost         = '(' . $xhost_name . '|' . $xipv4 . '|' . $xipv6 . ')';
320
+        $xhost         = '('.$xhost_name.'|'.$xipv4.'|'.$xipv6.')';
321 321
         $xport         = '(\d*)';
322
-        $xauthority    = '((' . $xuserinfo . '@)?' . $xhost .
323
-                        '?(:' . $xport . ')?)';
322
+        $xauthority    = '(('.$xuserinfo.'@)?'.$xhost.
323
+                        '?(:'.$xport.')?)';
324 324
 
325
-        $xslash_seg    = '(/[' . $xpchar . ']*)';
326
-        $xpath_authabs = '((//' . $xauthority . ')((/[' . $xpchar . ']*)*))';
327
-        $xpath_rel     = '([' . $xpchar . ']+' . $xslash_seg . '*)';
328
-        $xpath_abs     = '(/(' . $xpath_rel . ')?)';
329
-        $xapath        = '(' . $xpath_authabs . '|' . $xpath_abs .
330
-                        '|' . $xpath_rel . ')';
325
+        $xslash_seg    = '(/['.$xpchar.']*)';
326
+        $xpath_authabs = '((//'.$xauthority.')((/['.$xpchar.']*)*))';
327
+        $xpath_rel     = '(['.$xpchar.']+'.$xslash_seg.'*)';
328
+        $xpath_abs     = '(/('.$xpath_rel.')?)';
329
+        $xapath        = '('.$xpath_authabs.'|'.$xpath_abs.
330
+                        '|'.$xpath_rel.')';
331 331
 
332
-        $xqueryfrag    = '([' . $xpchar . '/?' . ']*)';
332
+        $xqueryfrag    = '(['.$xpchar.'/?'.']*)';
333 333
 
334
-        $xurl          = '^(' . $xscheme . ':)?' .  $xapath . '?' .
335
-                        '(\?' . $xqueryfrag . ')?(#' . $xqueryfrag . ')?$';
334
+        $xurl          = '^('.$xscheme.':)?'.$xapath.'?'.
335
+                        '(\?'.$xqueryfrag.')?(#'.$xqueryfrag.')?$';
336 336
     
337 337
     
338 338
         // Split the URL into components.
339
-        if (!preg_match('!' . $xurl . '!', $url, $m)) {
339
+        if (!preg_match('!'.$xurl.'!', $url, $m)) {
340 340
             return false;
341 341
         }
342 342
     
343 343
         if (!empty($m[2])) {
344
-            $parts['scheme']  = strtolower($m[2]);
344
+            $parts['scheme'] = strtolower($m[2]);
345 345
         }
346 346
     
347 347
         if (!empty($m[7])) {
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
             }
353 353
         }
354 354
         if (!empty($m[10])) {
355
-            $parts['pass']    = $m[11];
355
+            $parts['pass'] = $m[11];
356 356
         }
357 357
     
358 358
         if (!empty($m[13])) {
359
-            $h=$parts['host'] = $m[13];
359
+            $h = $parts['host'] = $m[13];
360 360
         } elseif (!empty($m[14])) {
361 361
             $parts['host']    = $m[14];
362 362
         } elseif (!empty($m[16])) {
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             $parts['query']   = $m[28];
381 381
         }
382 382
         if (!empty($m[29])) {
383
-            $parts['fragment']= $m[30];
383
+            $parts['fragment'] = $m[30];
384 384
         }
385 385
     
386 386
         if (!$decode) {
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
      * Code distributed under OSI BSD (http://www.opensource.org/licenses/bsd-license.php)
415 415
      *
416 416
      */
417
-    public static function joinUrl($parts, $encode=true)
417
+    public static function joinUrl($parts, $encode = true)
418 418
     {
419 419
         if ($encode) {
420 420
             if (isset($parts['user'])) {
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
             }
437 437
 
438 438
             if (isset($parts['query'])) {
439
-                $parts['query']    = rawurlencode($parts['query']);
439
+                $parts['query'] = rawurlencode($parts['query']);
440 440
             }
441 441
 
442 442
             if (isset($parts['fragment'])) {
@@ -446,25 +446,25 @@  discard block
 block discarded – undo
446 446
     
447 447
         $url = '';
448 448
         if (!empty($parts['scheme'])) {
449
-            $url .= $parts['scheme'] . ':';
449
+            $url .= $parts['scheme'].':';
450 450
         }
451 451
         if (isset($parts['host'])) {
452 452
             $url .= '//';
453 453
             if (isset($parts['user'])) {
454 454
                 $url .= $parts['user'];
455 455
                 if (isset($parts['pass'])) {
456
-                    $url .= ':' . $parts['pass'];
456
+                    $url .= ':'.$parts['pass'];
457 457
                 }
458 458
                 $url .= '@';
459 459
             }
460 460
             if (preg_match('!^[\da-f]*:[\da-f.:]+$!ui', $parts['host'])) {
461
-                $url .= '[' . $parts['host'] . ']';
461
+                $url .= '['.$parts['host'].']';
462 462
             } // IPv6
463 463
             else {
464 464
                 $url .= $parts['host'];
465 465
             }             // IPv4 or name
466 466
             if (isset($parts['port'])) {
467
-                $url .= ':' . $parts['port'];
467
+                $url .= ':'.$parts['port'];
468 468
             }
469 469
             if (!empty($parts['path']) && $parts['path'][0] != '/') {
470 470
                 $url .= '/';
@@ -474,10 +474,10 @@  discard block
 block discarded – undo
474 474
             $url .= $parts['path'];
475 475
         }
476 476
         if (isset($parts['query'])) {
477
-            $url .= '?' . $parts['query'];
477
+            $url .= '?'.$parts['query'];
478 478
         }
479 479
         if (isset($parts['fragment'])) {
480
-            $url .= '#' . $parts['fragment'];
480
+            $url .= '#'.$parts['fragment'];
481 481
         }
482 482
         return $url;
483 483
     }
Please login to merge, or discard this patch.