Completed
Push — master ( dbe86b...83d160 )
by Terry
02:56
created
bin/benchmark.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 
4
-require_once __DIR__ . '/../../../../vendor/autoload.php';
4
+require_once __DIR__.'/../../../../vendor/autoload.php';
5 5
 
6 6
 use function Terah\Assert\Assert;
7 7
 
@@ -14,30 +14,30 @@  discard block
 block discarded – undo
14 14
 echo "Benchmarking static Terah\\Assert";
15 15
 $start = microtime(true);
16 16
 
17
-for ( $i = 0 ; $i < 100000 ; $i++ )
17
+for ($i = 0; $i < 100000; $i++)
18 18
 {
19 19
     Assert::that(true)->true();
20 20
 }
21 21
 $time = microtime(true) - $start;
22
-echo "Taken: $time" . PHP_EOL;
22
+echo "Taken: $time".PHP_EOL;
23 23
 
24 24
 echo "Benchmarking new Terah\\Assert";
25 25
 $start = microtime(true);
26 26
 
27
-for ( $i = 0 ; $i < 100000 ; $i++ )
27
+for ($i = 0; $i < 100000; $i++)
28 28
 {
29 29
     Assert(true)->true();
30 30
 }
31 31
 $time = microtime(true) - $start;
32
-echo "Taken: $time" . PHP_EOL;
32
+echo "Taken: $time".PHP_EOL;
33 33
 
34 34
 echo "Benchmarking fluent Beberlei";
35 35
 $start = microtime(true);
36 36
 
37
-for ( $i = 0 ; $i < 100000 ; $i++ )
37
+for ($i = 0; $i < 100000; $i++)
38 38
 {
39 39
     Beberlei\that(true)->true();
40 40
 }
41 41
 $time = microtime(true) - $start;
42
-echo "Taken: $time" . PHP_EOL;
42
+echo "Taken: $time".PHP_EOL;
43 43
 
Please login to merge, or discard this patch.
src/ValidationFailedException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Terah\Assert;
4 4
 /**
Please login to merge, or discard this patch.
src/AssertionFailedException.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Terah\Assert;
4 4
 /**
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     private $constraints;
20 20
     private $level;
21 21
 
22
-    public function __construct($message, $code, $propertyPath = null, $value, array $constraints = [], $level='critical')
22
+    public function __construct($message, $code, $propertyPath = null, $value, array $constraints = [ ], $level = 'critical')
23 23
     {
24 24
         parent::__construct($message, $code);
25 25
         $this->propertyPath     = $propertyPath;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public function getPropertyPath()
40 40
     {
41 41
         $calling_location = $this->getCallingFileAndLine();
42
-        return $this->propertyPath . ' in ' .$calling_location;
42
+        return $this->propertyPath.' in '.$calling_location;
43 43
     }
44 44
 
45 45
     /**
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
      */
64 64
     protected function getCallingFileAndLine()
65 65
     {
66
-        foreach ( $this->getTrace() as $trace )
66
+        foreach ($this->getTrace() as $trace)
67 67
         {
68 68
             $trace = (object)$trace;
69
-            if ( empty($trace->file) )
69
+            if (empty($trace->file))
70 70
             {
71 71
                 continue;
72 72
             }
73 73
             $file = static::beforeLast('.php', static::afterLast('/', $trace->file));
74
-            if ( in_array($file, ['AssertionChain', 'Assertion']) )
74
+            if (in_array($file, [ 'AssertionChain', 'Assertion' ]))
75 75
             {
76 76
                 continue;
77 77
             }
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
         return $this->constraints;
100 100
     }
101 101
 
102
-    public static function afterLast($needle, $haystack, $return_original=false)
102
+    public static function afterLast($needle, $haystack, $return_original = false)
103 103
     {
104
-        if ( ! is_bool(static::strrevpos($haystack, $needle)) )
104
+        if ( ! is_bool(static::strrevpos($haystack, $needle)))
105 105
         {
106 106
             return mb_substr($haystack, static::strrevpos($haystack, $needle) + mb_strlen($needle));
107 107
         }
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Terah\Assert;
4 4
 
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  * @param bool|false $throwValidationError
8 8
  * @return Assert
9 9
  */
10
-function Assert($value, $throwValidationError=false)
10
+function Assert($value, $throwValidationError = false)
11 11
 {
12 12
     $assert = new Assert($value);
13
-    if ( ! $throwValidationError )
13
+    if ( ! $throwValidationError)
14 14
     {
15 15
         return $assert;
16 16
     }
@@ -25,23 +25,23 @@  discard block
 block discarded – undo
25 25
  * @param string $level
26 26
  * @return Assert
27 27
  */
28
-function Validate($value, $name='', $code=0, $error='', $level=Assert::WARNING)
28
+function Validate($value, $name = '', $code = 0, $error = '', $level = Assert::WARNING)
29 29
 {
30 30
     $assert = new Assert($value);
31 31
     $assert->setExceptionClass('Terah\Assert\ValidationFailedException');
32
-    if ( $name )
32
+    if ($name)
33 33
     {
34 34
         $assert->name($name);
35 35
     }
36
-    if ( $code )
36
+    if ($code)
37 37
     {
38 38
         $assert->code($code);
39 39
     }
40
-    if ( $error )
40
+    if ($error)
41 41
     {
42 42
         $assert->error($error);
43 43
     }
44
-    if ( $level )
44
+    if ($level)
45 45
     {
46 46
         $assert->level($level);
47 47
     }
Please login to merge, or discard this patch.
src/Assert.php 2 patches
Spacing   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Terah\Assert;
4 4
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      *
129 129
      * @var string
130 130
      */
131
-    protected $exceptionClass           = 'Terah\Assert\AssertionFailedException';
131
+    protected $exceptionClass = 'Terah\Assert\AssertionFailedException';
132 132
 
133 133
     /**
134 134
      * @param mixed $value
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @param string $level
209 209
      * @return AssertionFailedException
210 210
      */
211
-    protected function createException($message, $code, $propertyPath, array $constraints = [], $level=null)
211
+    protected function createException($message, $code, $propertyPath, array $constraints = [ ], $level = null)
212 212
     {
213 213
         $exceptionClass = $this->exceptionClass;
214 214
         $propertyPath   = is_null($propertyPath) ? $this->propertyPath : $propertyPath;
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
      */
279 279
     public function eq($value2, $message = null, $propertyPath = null)
280 280
     {
281
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
281
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
282 282
         {
283 283
             return $this;
284 284
         }
285
-        if ( $this->value != $value2 )
285
+        if ($this->value != $value2)
286 286
         {
287 287
             $message = $message ?: $this->overrideError;
288 288
             $message = sprintf(
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 $this->stringify($this->value),
291 291
                 $this->stringify($value2)
292 292
             );
293
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]);
293
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, [ 'expected' => $value2 ]);
294 294
         }
295 295
         return $this;
296 296
     }
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
      */
306 306
     public function greaterThan($value2, $message = null, $propertyPath = null)
307 307
     {
308
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
308
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
309 309
         {
310 310
             return $this;
311 311
         }
312
-        if ( ! ( $this->value > $value2 ) )
312
+        if ( ! ($this->value > $value2))
313 313
         {
314 314
             $message = $message ?: $this->overrideError;
315 315
             $message = sprintf(
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
                 $this->stringify($this->value),
318 318
                 $this->stringify($value2)
319 319
             );
320
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]);
320
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, [ 'expected' => $value2 ]);
321 321
         }
322 322
         return $this;
323 323
     }
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
      */
333 333
     public function greaterThanOrEq($value2, $message = null, $propertyPath = null)
334 334
     {
335
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
335
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
336 336
         {
337 337
             return $this;
338 338
         }
339
-        if ( ! ( $this->value >= $value2 ) )
339
+        if ( ! ($this->value >= $value2))
340 340
         {
341 341
             $message = $message ?: $this->overrideError;
342 342
             $message = sprintf(
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                 $this->stringify($this->value),
345 345
                 $this->stringify($value2)
346 346
             );
347
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]);
347
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, [ 'expected' => $value2 ]);
348 348
         }
349 349
         return $this;
350 350
     }
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
      */
360 360
     public function lessThan($value2, $message = null, $propertyPath = null)
361 361
     {
362
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
362
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
363 363
         {
364 364
             return $this;
365 365
         }
366
-        if ( ! ( $this->value < $value2 ) )
366
+        if ( ! ($this->value < $value2))
367 367
         {
368 368
             $message = $message ?: $this->overrideError;
369 369
             $message = sprintf(
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
                 $this->stringify($this->value),
372 372
                 $this->stringify($value2)
373 373
             );
374
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $propertyPath, ['expected' => $value2]);
374
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $propertyPath, [ 'expected' => $value2 ]);
375 375
         }
376 376
         return $this;
377 377
     }
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
      */
387 387
     public function lessThanOrEq($value2, $message = null, $propertyPath = null)
388 388
     {
389
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
389
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
390 390
         {
391 391
             return $this;
392 392
         }
393
-        if ( ! ( $this->value <= $value2 ) )
393
+        if ( ! ($this->value <= $value2))
394 394
         {
395 395
             $message = $message ?: $this->overrideError;
396 396
             $message = sprintf(
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                 $this->stringify($this->value),
399 399
                 $this->stringify($value2)
400 400
             );
401
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $propertyPath, ['expected' => $value2]);
401
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $propertyPath, [ 'expected' => $value2 ]);
402 402
         }
403 403
         return $this;
404 404
     }
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
      */
415 415
     public function same($value2, $message = null, $propertyPath = null)
416 416
     {
417
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
417
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
418 418
         {
419 419
             return $this;
420 420
         }
421
-        if ( $this->value !== $value2 )
421
+        if ($this->value !== $value2)
422 422
         {
423 423
             $message = $message ?: $this->overrideError;
424 424
             $message = sprintf(
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
                 $this->stringify($this->value),
427 427
                 $this->stringify($value2)
428 428
             );
429
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $propertyPath, ['expected' => $value2]);
429
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $propertyPath, [ 'expected' => $value2 ]);
430 430
         }
431 431
         return $this;
432 432
     }
@@ -442,11 +442,11 @@  discard block
 block discarded – undo
442 442
      */
443 443
     public function notEq($value2, $message = null, $propertyPath = null)
444 444
     {
445
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
445
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
446 446
         {
447 447
             return $this;
448 448
         }
449
-        if ( $this->value == $value2 )
449
+        if ($this->value == $value2)
450 450
         {
451 451
             $message = $message ?: $this->overrideError;
452 452
             $message = sprintf(
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
                 $this->stringify($this->value),
455 455
                 $this->stringify($value2)
456 456
             );
457
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $propertyPath, ['expected' => $value2]);
457
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $propertyPath, [ 'expected' => $value2 ]);
458 458
         }
459 459
         return $this;
460 460
     }
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
      */
469 469
     public function isCallable($message = null, $propertyPath = null)
470 470
     {
471
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
471
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
472 472
         {
473 473
             return $this;
474 474
         }
475
-        if ( !is_callable($this->value) )
475
+        if ( ! is_callable($this->value))
476 476
         {
477 477
             $message = $message ?: $this->overrideError;
478 478
             $message = sprintf(
@@ -495,11 +495,11 @@  discard block
 block discarded – undo
495 495
      */
496 496
     public function notSame($value2, $message = null, $propertyPath = null)
497 497
     {
498
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
498
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
499 499
         {
500 500
             return $this;
501 501
         }
502
-        if ( $this->value === $value2 )
502
+        if ($this->value === $value2)
503 503
         {
504 504
             $message = $message ?: $this->overrideError;
505 505
             $message = sprintf(
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
                 $this->stringify($this->value),
508 508
                 $this->stringify($value2)
509 509
             );
510
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $propertyPath, ['expected' => $value2]);
510
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $propertyPath, [ 'expected' => $value2 ]);
511 511
         }
512 512
         return $this;
513 513
     }
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
      * @return Assert
532 532
      * @throws AssertionFailedException
533 533
      */
534
-    public function unsignedInt($message=null, $propertyPath=null)
534
+    public function unsignedInt($message = null, $propertyPath = null)
535 535
     {
536 536
         $message = $message ?: $this->overrideError;
537 537
         $message = $message ?: 'Value "%s" is not an integer id.';
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     {
563 563
         $message = $message ?: $this->overrideError;
564 564
         $message = $message ?: 'Value "%s" is not a valid status.';
565
-        return $this->integer($message, $propertyPath)->inArray([-1, 0, 1]);
565
+        return $this->integer($message, $propertyPath)->inArray([-1, 0, 1 ]);
566 566
     }
567 567
 
568 568
     /**
@@ -606,11 +606,11 @@  discard block
 block discarded – undo
606 606
      */
607 607
     public function integer($message = null, $propertyPath = null)
608 608
     {
609
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
609
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
610 610
         {
611 611
             return $this;
612 612
         }
613
-        if ( !is_int($this->value) )
613
+        if ( ! is_int($this->value))
614 614
         {
615 615
             $message = $message ?: $this->overrideError;
616 616
             $message = sprintf(
@@ -632,11 +632,11 @@  discard block
 block discarded – undo
632 632
      */
633 633
     public function float($message = null, $propertyPath = null)
634 634
     {
635
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
635
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
636 636
         {
637 637
             return $this;
638 638
         }
639
-        if ( ! is_float($this->value) )
639
+        if ( ! is_float($this->value))
640 640
         {
641 641
             $message = $message ?: $this->overrideError;
642 642
             $message = sprintf(
@@ -658,11 +658,11 @@  discard block
 block discarded – undo
658 658
      */
659 659
     public function digit($message = null, $propertyPath = null)
660 660
     {
661
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
661
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
662 662
         {
663 663
             return $this;
664 664
         }
665
-        if ( ! ctype_digit((string)$this->value) )
665
+        if ( ! ctype_digit((string)$this->value))
666 666
         {
667 667
             $message = $message ?: $this->overrideError;
668 668
             $message = sprintf(
@@ -684,12 +684,12 @@  discard block
 block discarded – undo
684 684
      */
685 685
     public function date($message = null, $propertyPath = null)
686 686
     {
687
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
687
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
688 688
         {
689 689
             return $this;
690 690
         }
691 691
         $this->notEmpty($message, $propertyPath);
692
-        if ( strtotime($this->value) === false )
692
+        if (strtotime($this->value) === false)
693 693
         {
694 694
             $message = $message ?: $this->overrideError;
695 695
             $message = sprintf(
@@ -711,11 +711,11 @@  discard block
 block discarded – undo
711 711
      */
712 712
     public function integerish($message = null, $propertyPath = null)
713 713
     {
714
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
714
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
715 715
         {
716 716
             return $this;
717 717
         }
718
-        if ( is_object($this->value) || strval(intval($this->value)) != $this->value || is_bool($this->value) || is_null($this->value) )
718
+        if (is_object($this->value) || strval(intval($this->value)) != $this->value || is_bool($this->value) || is_null($this->value))
719 719
         {
720 720
             $message = $message ?: $this->overrideError;
721 721
             $message = sprintf(
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
      */
738 738
     public function boolean($message = null, $propertyPath = null)
739 739
     {
740
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
740
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
741 741
         {
742 742
             return $this;
743 743
         }
744
-        if ( ! is_bool($this->value) )
744
+        if ( ! is_bool($this->value))
745 745
         {
746 746
             $message = $message ?: $this->overrideError;
747 747
             $message = sprintf(
@@ -763,11 +763,11 @@  discard block
 block discarded – undo
763 763
      */
764 764
     public function scalar($message = null, $propertyPath = null)
765 765
     {
766
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
766
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
767 767
         {
768 768
             return $this;
769 769
         }
770
-        if ( ! is_scalar($this->value) )
770
+        if ( ! is_scalar($this->value))
771 771
         {
772 772
             $message = $message ?: $this->overrideError;
773 773
             $message = sprintf(
@@ -789,11 +789,11 @@  discard block
 block discarded – undo
789 789
      */
790 790
     public function notEmpty($message = null, $propertyPath = null)
791 791
     {
792
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
792
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
793 793
         {
794 794
             return $this;
795 795
         }
796
-        if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) )
796
+        if ((is_object($this->value) && empty((array)$this->value)) || empty($this->value))
797 797
         {
798 798
             $message = $message ?: $this->overrideError;
799 799
             $message = sprintf(
@@ -815,11 +815,11 @@  discard block
 block discarded – undo
815 815
      */
816 816
     public function noContent($message = null, $propertyPath = null)
817 817
     {
818
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
818
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
819 819
         {
820 820
             return $this;
821 821
         }
822
-        if ( !empty( $this->value ) )
822
+        if ( ! empty($this->value))
823 823
         {
824 824
             $message = $message ?: $this->overrideError;
825 825
             $message = sprintf(
@@ -841,11 +841,11 @@  discard block
 block discarded – undo
841 841
      */
842 842
     public function notNull($message = null, $propertyPath = null)
843 843
     {
844
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
844
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
845 845
         {
846 846
             return $this;
847 847
         }
848
-        if ( $this->value === null )
848
+        if ($this->value === null)
849 849
         {
850 850
             $message = $message ?: $this->overrideError;
851 851
             $message = sprintf(
@@ -867,11 +867,11 @@  discard block
 block discarded – undo
867 867
      */
868 868
     public function string($message = null, $propertyPath = null)
869 869
     {
870
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
870
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
871 871
         {
872 872
             return $this;
873 873
         }
874
-        if ( !is_string($this->value) )
874
+        if ( ! is_string($this->value))
875 875
         {
876 876
             $message = $message ?: $this->overrideError;
877 877
             $message = sprintf(
@@ -893,21 +893,21 @@  discard block
 block discarded – undo
893 893
      * @return Assert
894 894
      * @throws AssertionFailedException
895 895
      */
896
-    public function regex($pattern, $message=null, $propertyPath=null)
896
+    public function regex($pattern, $message = null, $propertyPath = null)
897 897
     {
898
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
898
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
899 899
         {
900 900
             return $this;
901 901
         }
902 902
         $this->string($message, $propertyPath);
903
-        if ( ! preg_match($pattern, $this->value) )
903
+        if ( ! preg_match($pattern, $this->value))
904 904
         {
905 905
             $message = $message ?: $this->overrideError;
906 906
             $message = sprintf(
907 907
                 $message ?: 'Value "%s" does not match expression.',
908 908
                 $this->stringify($this->value)
909 909
             );
910
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]);
910
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, [ 'pattern' => $pattern ]);
911 911
         }
912 912
         return $this;
913 913
     }
@@ -920,13 +920,13 @@  discard block
 block discarded – undo
920 920
      */
921 921
     public function ipAddress($message = null, $propertyPath = null)
922 922
     {
923
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
923
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
924 924
         {
925 925
             return $this;
926 926
         }
927 927
         $this->string($message, $propertyPath);
928
-        $pattern   = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
929
-        if ( ! preg_match($pattern, $this->value) )
928
+        $pattern = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
929
+        if ( ! preg_match($pattern, $this->value))
930 930
         {
931 931
             $message = $message ?: $this->overrideError;
932 932
             $message = sprintf(
@@ -947,19 +947,19 @@  discard block
 block discarded – undo
947 947
      */
948 948
     public function notRegex($pattern, $message = null, $propertyPath = null)
949 949
     {
950
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
950
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
951 951
         {
952 952
             return $this;
953 953
         }
954 954
         $this->string($message, $propertyPath);
955
-        if ( preg_match($pattern, $this->value) )
955
+        if (preg_match($pattern, $this->value))
956 956
         {
957 957
             $message = $message ?: $this->overrideError;
958 958
             $message = sprintf(
959 959
                 $message ?: 'Value "%s" does not match expression.',
960 960
                 $this->stringify($this->value)
961 961
             );
962
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]);
962
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, [ 'pattern' => $pattern ]);
963 963
         }
964 964
         return $this;
965 965
     }
@@ -976,12 +976,12 @@  discard block
 block discarded – undo
976 976
      */
977 977
     public function length($length, $message = null, $propertyPath = null, $encoding = 'utf8')
978 978
     {
979
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
979
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
980 980
         {
981 981
             return $this;
982 982
         }
983 983
         $this->string($message, $propertyPath);
984
-        if ( mb_strlen($this->value, $encoding) !== $length )
984
+        if (mb_strlen($this->value, $encoding) !== $length)
985 985
         {
986 986
             $message    = $message ?: $this->overrideError;
987 987
             $message    = sprintf(
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
                 $length,
991 991
                 mb_strlen($this->value, $encoding)
992 992
             );
993
-            $constraints = ['length' => $length, 'encoding' => $encoding];
993
+            $constraints = [ 'length' => $length, 'encoding' => $encoding ];
994 994
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_LENGTH, $propertyPath, $constraints);
995 995
         }
996 996
         return $this;
@@ -1008,22 +1008,22 @@  discard block
 block discarded – undo
1008 1008
      */
1009 1009
     public function minLength($minLength, $message = null, $propertyPath = null, $encoding = 'utf8')
1010 1010
     {
1011
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1011
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1012 1012
         {
1013 1013
             return $this;
1014 1014
         }
1015 1015
         $this->string($message, $propertyPath);
1016
-        if ( mb_strlen($this->value, $encoding) < $minLength )
1016
+        if (mb_strlen($this->value, $encoding) < $minLength)
1017 1017
         {
1018 1018
             $message = $message ?: $this->overrideError;
1019
-            $message     = sprintf(
1019
+            $message = sprintf(
1020 1020
                 $message
1021 1021
                     ?: 'Value "%s" is too short, it should have more than %d characters, but only has %d characters.',
1022 1022
                 $this->stringify($this->value),
1023 1023
                 $minLength,
1024 1024
                 mb_strlen($this->value, $encoding)
1025 1025
             );
1026
-            $constraints = ['min_length' => $minLength, 'encoding' => $encoding];
1026
+            $constraints = [ 'min_length' => $minLength, 'encoding' => $encoding ];
1027 1027
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN_LENGTH, $propertyPath, $constraints);
1028 1028
         }
1029 1029
         return $this;
@@ -1041,21 +1041,21 @@  discard block
 block discarded – undo
1041 1041
      */
1042 1042
     public function maxLength($maxLength, $message = null, $propertyPath = null, $encoding = 'utf8')
1043 1043
     {
1044
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1044
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1045 1045
         {
1046 1046
             return $this;
1047 1047
         }
1048 1048
         $this->string($message, $propertyPath);
1049
-        if ( mb_strlen($this->value, $encoding) > $maxLength )
1049
+        if (mb_strlen($this->value, $encoding) > $maxLength)
1050 1050
         {
1051 1051
             $message = $message ?: $this->overrideError;
1052
-            $message     = sprintf(
1052
+            $message = sprintf(
1053 1053
                 $message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.',
1054 1054
                 $this->stringify($this->value),
1055 1055
                 $maxLength,
1056 1056
                 mb_strlen($this->value, $encoding)
1057 1057
             );
1058
-            $constraints = ['max_length' => $maxLength, 'encoding' => $encoding];
1058
+            $constraints = [ 'max_length' => $maxLength, 'encoding' => $encoding ];
1059 1059
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX_LENGTH, $propertyPath, $constraints);
1060 1060
         }
1061 1061
         return $this;
@@ -1074,34 +1074,34 @@  discard block
 block discarded – undo
1074 1074
      */
1075 1075
     public function betweenLength($minLength, $maxLength, $message = null, $propertyPath = null, $encoding = 'utf8')
1076 1076
     {
1077
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1077
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1078 1078
         {
1079 1079
             return $this;
1080 1080
         }
1081 1081
         $this->string($message, $propertyPath);
1082
-        if ( mb_strlen($this->value, $encoding) < $minLength )
1082
+        if (mb_strlen($this->value, $encoding) < $minLength)
1083 1083
         {
1084 1084
             $message = $message ?: $this->overrideError;
1085
-            $message     = sprintf(
1085
+            $message = sprintf(
1086 1086
                 $message
1087 1087
                     ?: 'Value "%s" is too short, it should have more than %d characters, but only has %d characters.',
1088 1088
                 $this->stringify($this->value),
1089 1089
                 $minLength,
1090 1090
                 mb_strlen($this->value, $encoding)
1091 1091
             );
1092
-            $constraints = ['min_length' => $minLength, 'encoding' => $encoding];
1092
+            $constraints = [ 'min_length' => $minLength, 'encoding' => $encoding ];
1093 1093
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN_LENGTH, $propertyPath, $constraints);
1094 1094
         }
1095
-        if ( mb_strlen($this->value, $encoding) > $maxLength )
1095
+        if (mb_strlen($this->value, $encoding) > $maxLength)
1096 1096
         {
1097 1097
             $message = $message ?: $this->overrideError;
1098
-            $message     = sprintf(
1098
+            $message = sprintf(
1099 1099
                 $message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.',
1100 1100
                 $this->stringify($this->value),
1101 1101
                 $maxLength,
1102 1102
                 mb_strlen($this->value, $encoding)
1103 1103
             );
1104
-            $constraints = ['max_length' => $maxLength, 'encoding' => $encoding];
1104
+            $constraints = [ 'max_length' => $maxLength, 'encoding' => $encoding ];
1105 1105
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX_LENGTH, $propertyPath, $constraints);
1106 1106
         }
1107 1107
         return $this;
@@ -1119,20 +1119,20 @@  discard block
 block discarded – undo
1119 1119
      */
1120 1120
     public function startsWith($needle, $message = null, $propertyPath = null, $encoding = 'utf8')
1121 1121
     {
1122
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1122
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1123 1123
         {
1124 1124
             return $this;
1125 1125
         }
1126 1126
         $this->string($message, $propertyPath);
1127
-        if ( mb_strpos($this->value, $needle, null, $encoding) !== 0 )
1127
+        if (mb_strpos($this->value, $needle, null, $encoding) !== 0)
1128 1128
         {
1129 1129
             $message = $message ?: $this->overrideError;
1130
-            $message     = sprintf(
1130
+            $message = sprintf(
1131 1131
                 $message ?: 'Value "%s" does not start with "%s".',
1132 1132
                 $this->stringify($this->value),
1133 1133
                 $this->stringify($needle)
1134 1134
             );
1135
-            $constraints = ['needle' => $needle, 'encoding' => $encoding];
1135
+            $constraints = [ 'needle' => $needle, 'encoding' => $encoding ];
1136 1136
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_START, $propertyPath, $constraints);
1137 1137
         }
1138 1138
         return $this;
@@ -1150,21 +1150,21 @@  discard block
 block discarded – undo
1150 1150
      */
1151 1151
     public function endsWith($needle, $message = null, $propertyPath = null, $encoding = 'utf8')
1152 1152
     {
1153
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1153
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1154 1154
         {
1155 1155
             return $this;
1156 1156
         }
1157 1157
         $this->string($message, $propertyPath);
1158 1158
         $stringPosition = mb_strlen($this->value, $encoding) - mb_strlen($needle, $encoding);
1159
-        if ( mb_strripos($this->value, $needle, null, $encoding) !== $stringPosition )
1159
+        if (mb_strripos($this->value, $needle, null, $encoding) !== $stringPosition)
1160 1160
         {
1161 1161
             $message = $message ?: $this->overrideError;
1162
-            $message     = sprintf(
1162
+            $message = sprintf(
1163 1163
                 $message ?: 'Value "%s" does not end with "%s".',
1164 1164
                 $this->stringify($this->value),
1165 1165
                 $this->stringify($needle)
1166 1166
             );
1167
-            $constraints = ['needle' => $needle, 'encoding' => $encoding];
1167
+            $constraints = [ 'needle' => $needle, 'encoding' => $encoding ];
1168 1168
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_END, $propertyPath, $constraints);
1169 1169
         }
1170 1170
         return $this;
@@ -1182,20 +1182,20 @@  discard block
 block discarded – undo
1182 1182
      */
1183 1183
     public function contains($needle, $message = null, $propertyPath = null, $encoding = 'utf8')
1184 1184
     {
1185
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1185
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1186 1186
         {
1187 1187
             return $this;
1188 1188
         }
1189 1189
         $this->string($message, $propertyPath);
1190
-        if ( mb_strpos($this->value, $needle, null, $encoding) === false )
1190
+        if (mb_strpos($this->value, $needle, null, $encoding) === false)
1191 1191
         {
1192 1192
             $message = $message ?: $this->overrideError;
1193
-            $message     = sprintf(
1193
+            $message = sprintf(
1194 1194
                 $message ?: 'Value "%s" does not contain "%s".',
1195 1195
                 $this->stringify($this->value),
1196 1196
                 $this->stringify($needle)
1197 1197
             );
1198
-            $constraints = ['needle' => $needle, 'encoding' => $encoding];
1198
+            $constraints = [ 'needle' => $needle, 'encoding' => $encoding ];
1199 1199
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_CONTAINS, $propertyPath, $constraints);
1200 1200
         }
1201 1201
         return $this;
@@ -1212,11 +1212,11 @@  discard block
 block discarded – undo
1212 1212
      */
1213 1213
     public function choice(array $choices, $message = null, $propertyPath = null)
1214 1214
     {
1215
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1215
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1216 1216
         {
1217 1217
             return $this;
1218 1218
         }
1219
-        if ( !in_array($this->value, $choices, true) )
1219
+        if ( ! in_array($this->value, $choices, true))
1220 1220
         {
1221 1221
             $message = $message ?: $this->overrideError;
1222 1222
             $message = sprintf(
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
                 $this->stringify($this->value),
1225 1225
                 implode(", ", array_map('Terah\Assert\Assert::stringify', $choices))
1226 1226
             );
1227
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_CHOICE, $propertyPath, ['choices' => $choices]);
1227
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_CHOICE, $propertyPath, [ 'choices' => $choices ]);
1228 1228
         }
1229 1229
         return $this;
1230 1230
     }
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
      */
1242 1242
     public function inArray(array $choices, $message = null, $propertyPath = null)
1243 1243
     {
1244
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1244
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1245 1245
         {
1246 1246
             return $this;
1247 1247
         }
@@ -1259,11 +1259,11 @@  discard block
 block discarded – undo
1259 1259
      */
1260 1260
     public function numeric($message = null, $propertyPath = null)
1261 1261
     {
1262
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1262
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1263 1263
         {
1264 1264
             return $this;
1265 1265
         }
1266
-        if ( ! is_numeric($this->value) )
1266
+        if ( ! is_numeric($this->value))
1267 1267
         {
1268 1268
             $message = $message ?: $this->overrideError;
1269 1269
             $message = sprintf(
@@ -1321,11 +1321,11 @@  discard block
 block discarded – undo
1321 1321
      */
1322 1322
     public function isArray($message = null, $propertyPath = null)
1323 1323
     {
1324
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1324
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1325 1325
         {
1326 1326
             return $this;
1327 1327
         }
1328
-        if ( !is_array($this->value) )
1328
+        if ( ! is_array($this->value))
1329 1329
         {
1330 1330
             $message = $message ?: $this->overrideError;
1331 1331
             $message = sprintf(
@@ -1347,11 +1347,11 @@  discard block
 block discarded – undo
1347 1347
      */
1348 1348
     public function isTraversable($message = null, $propertyPath = null)
1349 1349
     {
1350
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1350
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1351 1351
         {
1352 1352
             return $this;
1353 1353
         }
1354
-        if ( !is_array($this->value) && !$this->value instanceof \Traversable )
1354
+        if ( ! is_array($this->value) && ! $this->value instanceof \Traversable)
1355 1355
         {
1356 1356
             $message = $message ?: $this->overrideError;
1357 1357
             $message = sprintf(
@@ -1373,11 +1373,11 @@  discard block
 block discarded – undo
1373 1373
      */
1374 1374
     public function isArrayAccessible($message = null, $propertyPath = null)
1375 1375
     {
1376
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1376
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1377 1377
         {
1378 1378
             return $this;
1379 1379
         }
1380
-        if ( !is_array($this->value) && !$this->value instanceof \ArrayAccess )
1380
+        if ( ! is_array($this->value) && ! $this->value instanceof \ArrayAccess)
1381 1381
         {
1382 1382
             $message = $message ?: $this->overrideError;
1383 1383
             $message = sprintf(
@@ -1400,19 +1400,19 @@  discard block
 block discarded – undo
1400 1400
      */
1401 1401
     public function keyExists($key, $message = null, $propertyPath = null)
1402 1402
     {
1403
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1403
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1404 1404
         {
1405 1405
             return $this;
1406 1406
         }
1407 1407
         $this->isArray($message, $propertyPath);
1408
-        if ( !array_key_exists($key, $this->value) )
1408
+        if ( ! array_key_exists($key, $this->value))
1409 1409
         {
1410 1410
             $message = $message ?: $this->overrideError;
1411 1411
             $message = sprintf(
1412 1412
                 $message ?: 'Array does not contain an element with key "%s"',
1413 1413
                 $this->stringify($key)
1414 1414
             );
1415
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_EXISTS, $propertyPath, ['key' => $key]);
1415
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_EXISTS, $propertyPath, [ 'key' => $key ]);
1416 1416
         }
1417 1417
         return $this;
1418 1418
     }
@@ -1428,21 +1428,21 @@  discard block
 block discarded – undo
1428 1428
      */
1429 1429
     public function keysExist($keys, $message = null, $propertyPath = null)
1430 1430
     {
1431
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1431
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1432 1432
         {
1433 1433
             return $this;
1434 1434
         }
1435 1435
         $this->isArray($message, $propertyPath);
1436
-        foreach ( $keys as $key )
1436
+        foreach ($keys as $key)
1437 1437
         {
1438
-            if ( !array_key_exists($key, $this->value) )
1438
+            if ( ! array_key_exists($key, $this->value))
1439 1439
             {
1440 1440
                 $message = $message
1441 1441
                     ?: sprintf(
1442 1442
                         'Array does not contain an element with key "%s"',
1443 1443
                         $this->stringify($key)
1444 1444
                     );
1445
-                throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEYS_EXIST, $propertyPath, ['key' => $key]);
1445
+                throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEYS_EXIST, $propertyPath, [ 'key' => $key ]);
1446 1446
             }
1447 1447
         }
1448 1448
         return $this;
@@ -1459,19 +1459,19 @@  discard block
 block discarded – undo
1459 1459
      */
1460 1460
     public function propertyExists($key, $message = null, $propertyPath = null)
1461 1461
     {
1462
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1462
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1463 1463
         {
1464 1464
             return $this;
1465 1465
         }
1466 1466
         $this->isObject($message, $propertyPath);
1467
-        if ( !property_exists($this->value, $key) && !isset( $this->value->{$key} ) )
1467
+        if ( ! property_exists($this->value, $key) && ! isset($this->value->{$key} ))
1468 1468
         {
1469 1469
             $message = $message
1470 1470
                 ?: sprintf(
1471 1471
                     'Object does not contain a property with key "%s"',
1472 1472
                     $this->stringify($key)
1473 1473
                 );
1474
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTY_EXISTS, $propertyPath, ['key' => $key]);
1474
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTY_EXISTS, $propertyPath, [ 'key' => $key ]);
1475 1475
         }
1476 1476
         return $this;
1477 1477
     }
@@ -1487,22 +1487,22 @@  discard block
 block discarded – undo
1487 1487
      */
1488 1488
     public function propertiesExist(array $keys, $message = null, $propertyPath = null)
1489 1489
     {
1490
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1490
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1491 1491
         {
1492 1492
             return $this;
1493 1493
         }
1494 1494
         $this->isObject($message, $propertyPath);
1495
-        foreach ( $keys as $key )
1495
+        foreach ($keys as $key)
1496 1496
         {
1497 1497
             // Using isset to allow resolution of magically defined properties
1498
-            if ( !property_exists($this->value, $key) && !isset( $this->value->{$key} ) )
1498
+            if ( ! property_exists($this->value, $key) && ! isset($this->value->{$key} ))
1499 1499
             {
1500 1500
                 $message = $message
1501 1501
                     ?: sprintf(
1502 1502
                         'Object does not contain a property with key "%s"',
1503 1503
                         $this->stringify($key)
1504 1504
                     );
1505
-                throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTIES_EXIST, $propertyPath, ['key' => $key]);
1505
+                throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTIES_EXIST, $propertyPath, [ 'key' => $key ]);
1506 1506
             }
1507 1507
         }
1508 1508
         return $this;
@@ -1518,12 +1518,12 @@  discard block
 block discarded – undo
1518 1518
      */
1519 1519
     public function utf8($message = null, $propertyPath = null)
1520 1520
     {
1521
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1521
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1522 1522
         {
1523 1523
             return $this;
1524 1524
         }
1525 1525
         $this->string($message, $propertyPath);
1526
-        if ( mb_detect_encoding($this->value, 'UTF-8', true) !== 'UTF-8' )
1526
+        if (mb_detect_encoding($this->value, 'UTF-8', true) !== 'UTF-8')
1527 1527
         {
1528 1528
             $message = $message
1529 1529
                 ?: sprintf(
@@ -1546,12 +1546,12 @@  discard block
 block discarded – undo
1546 1546
      */
1547 1547
     public function ascii($message = null, $propertyPath = null)
1548 1548
     {
1549
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1549
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1550 1550
         {
1551 1551
             return $this;
1552 1552
         }
1553 1553
         $this->string($message, $propertyPath);
1554
-        if ( ! preg_match('/^[ -~]+$/', $this->value) )
1554
+        if ( ! preg_match('/^[ -~]+$/', $this->value))
1555 1555
         {
1556 1556
             $message = $message
1557 1557
                 ?: sprintf(
@@ -1574,19 +1574,19 @@  discard block
 block discarded – undo
1574 1574
      */
1575 1575
     public function keyIsset($key, $message = null, $propertyPath = null)
1576 1576
     {
1577
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1577
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1578 1578
         {
1579 1579
             return $this;
1580 1580
         }
1581 1581
         $this->isArrayAccessible($message, $propertyPath);
1582
-        if ( !isset( $this->value[$key] ) )
1582
+        if ( ! isset($this->value[ $key ]))
1583 1583
         {
1584 1584
             $message = $message ?: $this->overrideError;
1585 1585
             $message = sprintf(
1586 1586
                 $message ?: 'The element with key "%s" was not found',
1587 1587
                 $this->stringify($key)
1588 1588
             );
1589
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_ISSET, $propertyPath, ['key' => $key]);
1589
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_ISSET, $propertyPath, [ 'key' => $key ]);
1590 1590
         }
1591 1591
         return $this;
1592 1592
     }
@@ -1602,12 +1602,12 @@  discard block
 block discarded – undo
1602 1602
      */
1603 1603
     public function notEmptyKey($key, $message = null, $propertyPath = null)
1604 1604
     {
1605
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1605
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1606 1606
         {
1607 1607
             return $this;
1608 1608
         }
1609 1609
         $this->keyIsset($key, $message, $propertyPath);
1610
-        (new Assert($this->value[$key]))->setExceptionClass($this->exceptionClass)->notEmpty($message, $propertyPath);
1610
+        (new Assert($this->value[ $key ]))->setExceptionClass($this->exceptionClass)->notEmpty($message, $propertyPath);
1611 1611
         return $this;
1612 1612
     }
1613 1613
 
@@ -1621,11 +1621,11 @@  discard block
 block discarded – undo
1621 1621
      */
1622 1622
     public function notBlank($message = null, $propertyPath = null)
1623 1623
     {
1624
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1624
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1625 1625
         {
1626 1626
             return $this;
1627 1627
         }
1628
-        if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) )
1628
+        if (false === $this->value || (empty($this->value) && '0' != $this->value))
1629 1629
         {
1630 1630
             $message = $message ?: $this->overrideError;
1631 1631
             $message = sprintf(
@@ -1648,11 +1648,11 @@  discard block
 block discarded – undo
1648 1648
      */
1649 1649
     public function isInstanceOf($className, $message = null, $propertyPath = null)
1650 1650
     {
1651
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1651
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1652 1652
         {
1653 1653
             return $this;
1654 1654
         }
1655
-        if ( !( $this->value instanceof $className ) )
1655
+        if ( ! ($this->value instanceof $className))
1656 1656
         {
1657 1657
             $message = $message ?: $this->overrideError;
1658 1658
             $message = sprintf(
@@ -1660,7 +1660,7 @@  discard block
 block discarded – undo
1660 1660
                 $this->stringify($this->value),
1661 1661
                 $className
1662 1662
             );
1663
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $propertyPath, ['class' => $className]);
1663
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $propertyPath, [ 'class' => $className ]);
1664 1664
         }
1665 1665
         return $this;
1666 1666
     }
@@ -1676,11 +1676,11 @@  discard block
 block discarded – undo
1676 1676
      */
1677 1677
     public function notIsInstanceOf($className, $message = null, $propertyPath = null)
1678 1678
     {
1679
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1679
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1680 1680
         {
1681 1681
             return $this;
1682 1682
         }
1683
-        if ( $this->value instanceof $className )
1683
+        if ($this->value instanceof $className)
1684 1684
         {
1685 1685
             $message = $message ?: $this->overrideError;
1686 1686
             $message = sprintf(
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
                 $this->stringify($this->value),
1689 1689
                 $className
1690 1690
             );
1691
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $propertyPath, ['class' => $className]);
1691
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $propertyPath, [ 'class' => $className ]);
1692 1692
         }
1693 1693
         return $this;
1694 1694
     }
@@ -1704,11 +1704,11 @@  discard block
 block discarded – undo
1704 1704
      */
1705 1705
     public function subclassOf($className, $message = null, $propertyPath = null)
1706 1706
     {
1707
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1707
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1708 1708
         {
1709 1709
             return $this;
1710 1710
         }
1711
-        if ( !is_subclass_of($this->value, $className) )
1711
+        if ( ! is_subclass_of($this->value, $className))
1712 1712
         {
1713 1713
             $message = $message ?: $this->overrideError;
1714 1714
             $message = sprintf(
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
                 $this->stringify($this->value),
1717 1717
                 $className
1718 1718
             );
1719
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $propertyPath, ['class' => $className]);
1719
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $propertyPath, [ 'class' => $className ]);
1720 1720
         }
1721 1721
         return $this;
1722 1722
     }
@@ -1733,12 +1733,12 @@  discard block
 block discarded – undo
1733 1733
      */
1734 1734
     public function range($minValue, $maxValue, $message = null, $propertyPath = null)
1735 1735
     {
1736
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1736
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1737 1737
         {
1738 1738
             return $this;
1739 1739
         }
1740 1740
         $this->numeric($message, $propertyPath);
1741
-        if ( $this->value < $minValue || $this->value > $maxValue )
1741
+        if ($this->value < $minValue || $this->value > $maxValue)
1742 1742
         {
1743 1743
             $message = $message ?: $this->overrideError;
1744 1744
             $message = sprintf(
@@ -1766,12 +1766,12 @@  discard block
 block discarded – undo
1766 1766
      */
1767 1767
     public function min($minValue, $message = null, $propertyPath = null)
1768 1768
     {
1769
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1769
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1770 1770
         {
1771 1771
             return $this;
1772 1772
         }
1773 1773
         $this->numeric($message, $propertyPath);
1774
-        if ( $this->value < $minValue )
1774
+        if ($this->value < $minValue)
1775 1775
         {
1776 1776
             $message = $message ?: $this->overrideError;
1777 1777
             $message = sprintf(
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
                 $this->stringify($this->value),
1780 1780
                 $this->stringify($minValue)
1781 1781
             );
1782
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $propertyPath, ['min' => $minValue]);
1782
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $propertyPath, [ 'min' => $minValue ]);
1783 1783
         }
1784 1784
         return $this;
1785 1785
     }
@@ -1795,12 +1795,12 @@  discard block
 block discarded – undo
1795 1795
      */
1796 1796
     public function max($maxValue, $message = null, $propertyPath = null)
1797 1797
     {
1798
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1798
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1799 1799
         {
1800 1800
             return $this;
1801 1801
         }
1802 1802
         $this->numeric($message, $propertyPath);
1803
-        if ( $this->value > $maxValue )
1803
+        if ($this->value > $maxValue)
1804 1804
         {
1805 1805
             $message = $message ?: $this->overrideError;
1806 1806
             $message = sprintf(
@@ -1808,7 +1808,7 @@  discard block
 block discarded – undo
1808 1808
                 $this->stringify($this->value),
1809 1809
                 $this->stringify($maxValue)
1810 1810
             );
1811
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $propertyPath, ['max' => $maxValue]);
1811
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $propertyPath, [ 'max' => $maxValue ]);
1812 1812
         }
1813 1813
         return $this;
1814 1814
     }
@@ -1823,13 +1823,13 @@  discard block
 block discarded – undo
1823 1823
      */
1824 1824
     public function file($message = null, $propertyPath = null)
1825 1825
     {
1826
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1826
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1827 1827
         {
1828 1828
             return $this;
1829 1829
         }
1830 1830
         $this->string($message, $propertyPath);
1831 1831
         $this->notEmpty($message, $propertyPath);
1832
-        if ( !is_file($this->value) )
1832
+        if ( ! is_file($this->value))
1833 1833
         {
1834 1834
             $message = $message ?: $this->overrideError;
1835 1835
             $message = sprintf(
@@ -1849,13 +1849,13 @@  discard block
 block discarded – undo
1849 1849
      */
1850 1850
     public function fileExists($message = null, $propertyPath = null)
1851 1851
     {
1852
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1852
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1853 1853
         {
1854 1854
             return $this;
1855 1855
         }
1856 1856
         $this->string($message, $propertyPath);
1857 1857
         $this->notEmpty($message, $propertyPath);
1858
-        if ( ! file_exists($this->value) )
1858
+        if ( ! file_exists($this->value))
1859 1859
         {
1860 1860
             $message = $message ?: $this->overrideError;
1861 1861
             $message = sprintf(
@@ -1877,12 +1877,12 @@  discard block
 block discarded – undo
1877 1877
      */
1878 1878
     public function directory($message = null, $propertyPath = null)
1879 1879
     {
1880
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1880
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1881 1881
         {
1882 1882
             return $this;
1883 1883
         }
1884 1884
         $this->string($message, $propertyPath);
1885
-        if ( !is_dir($this->value) )
1885
+        if ( ! is_dir($this->value))
1886 1886
         {
1887 1887
             $message = $message ?: $this->overrideError;
1888 1888
             $message = sprintf(
@@ -1904,12 +1904,12 @@  discard block
 block discarded – undo
1904 1904
      */
1905 1905
     public function readable($message = null, $propertyPath = null)
1906 1906
     {
1907
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1907
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1908 1908
         {
1909 1909
             return $this;
1910 1910
         }
1911 1911
         $this->string($message, $propertyPath);
1912
-        if ( !is_readable($this->value) )
1912
+        if ( ! is_readable($this->value))
1913 1913
         {
1914 1914
             $message = $message ?: $this->overrideError;
1915 1915
             $message = sprintf(
@@ -1931,12 +1931,12 @@  discard block
 block discarded – undo
1931 1931
      */
1932 1932
     public function writeable($message = null, $propertyPath = null)
1933 1933
     {
1934
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1934
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1935 1935
         {
1936 1936
             return $this;
1937 1937
         }
1938 1938
         $this->string($message, $propertyPath);
1939
-        if ( !is_writeable($this->value) )
1939
+        if ( ! is_writeable($this->value))
1940 1940
         {
1941 1941
             $message = $message ?: $this->overrideError;
1942 1942
             $message = sprintf(
@@ -1959,12 +1959,12 @@  discard block
 block discarded – undo
1959 1959
      */
1960 1960
     public function email($message = null, $propertyPath = null)
1961 1961
     {
1962
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1962
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1963 1963
         {
1964 1964
             return $this;
1965 1965
         }
1966 1966
         $this->string($message, $propertyPath);
1967
-        if ( ! filter_var($this->value, FILTER_VALIDATE_EMAIL) )
1967
+        if ( ! filter_var($this->value, FILTER_VALIDATE_EMAIL))
1968 1968
         {
1969 1969
             $message = $message ?: $this->overrideError;
1970 1970
             $message = sprintf(
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
         {
1978 1978
             $host = substr($this->value, strpos($this->value, '@') + 1);
1979 1979
             // Likely not a FQDN, bug in PHP FILTER_VALIDATE_EMAIL prior to PHP 5.3.3
1980
-            if ( version_compare(PHP_VERSION, '5.3.3', '<') && strpos($host, '.') === false )
1980
+            if (version_compare(PHP_VERSION, '5.3.3', '<') && strpos($host, '.') === false)
1981 1981
             {
1982 1982
                 $message = $message ?: $this->overrideError;
1983 1983
                 $message = sprintf(
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
      */
1999 1999
     public function emailPrefix($message = null, $propertyPath = null)
2000 2000
     {
2001
-        $this->value($this->value . '@example.com');
2001
+        $this->value($this->value.'@example.com');
2002 2002
         return $this->email($message, $propertyPath);
2003 2003
     }
2004 2004
 
@@ -2018,12 +2018,12 @@  discard block
 block discarded – undo
2018 2018
      */
2019 2019
     public function url($message = null, $propertyPath = null)
2020 2020
     {
2021
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2021
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2022 2022
         {
2023 2023
             return $this;
2024 2024
         }
2025 2025
         $this->string($message, $propertyPath);
2026
-        $protocols = ['http', 'https'];
2026
+        $protocols = [ 'http', 'https' ];
2027 2027
         $pattern   = '~^
2028 2028
             (%s)://                                 # protocol
2029 2029
             (
@@ -2038,8 +2038,8 @@  discard block
 block discarded – undo
2038 2038
             (:[0-9]+)?                              # a port (optional)
2039 2039
             (/?|/\S+)                               # a /, nothing or a / with something
2040 2040
         $~ixu';
2041
-        $pattern   = sprintf($pattern, implode('|', $protocols));
2042
-        if ( !preg_match($pattern, $this->value) )
2041
+        $pattern = sprintf($pattern, implode('|', $protocols));
2042
+        if ( ! preg_match($pattern, $this->value))
2043 2043
         {
2044 2044
             $message = $message ?: $this->overrideError;
2045 2045
             $message = sprintf(
@@ -2064,13 +2064,13 @@  discard block
 block discarded – undo
2064 2064
      */
2065 2065
     public function domainName($message = null, $propertyPath = null)
2066 2066
     {
2067
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2067
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2068 2068
         {
2069 2069
             return $this;
2070 2070
         }
2071 2071
         $this->string($message, $propertyPath);
2072
-        $pattern   = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/';
2073
-        if ( ! preg_match($pattern, $this->value) )
2072
+        $pattern = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/';
2073
+        if ( ! preg_match($pattern, $this->value))
2074 2074
         {
2075 2075
             $message = $message ?: $this->overrideError;
2076 2076
             $message = sprintf(
@@ -2092,7 +2092,7 @@  discard block
 block discarded – undo
2092 2092
      */
2093 2093
     public function alnum($message = null, $propertyPath = null)
2094 2094
     {
2095
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2095
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2096 2096
         {
2097 2097
             return $this;
2098 2098
         }
@@ -2123,11 +2123,11 @@  discard block
 block discarded – undo
2123 2123
      */
2124 2124
     public function true($message = null, $propertyPath = null)
2125 2125
     {
2126
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2126
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2127 2127
         {
2128 2128
             return $this;
2129 2129
         }
2130
-        if ( $this->value !== true )
2130
+        if ($this->value !== true)
2131 2131
         {
2132 2132
             $message = $message ?: $this->overrideError;
2133 2133
             $message = sprintf(
@@ -2149,11 +2149,11 @@  discard block
 block discarded – undo
2149 2149
      */
2150 2150
     public function truthy($message = null, $propertyPath = null)
2151 2151
     {
2152
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2152
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2153 2153
         {
2154 2154
             return $this;
2155 2155
         }
2156
-        if ( ! $this->value )
2156
+        if ( ! $this->value)
2157 2157
         {
2158 2158
             $message = $message ?: $this->overrideError;
2159 2159
             $message = sprintf(
@@ -2175,11 +2175,11 @@  discard block
 block discarded – undo
2175 2175
      */
2176 2176
     public function false($message = null, $propertyPath = null)
2177 2177
     {
2178
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2178
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2179 2179
         {
2180 2180
             return $this;
2181 2181
         }
2182
-        if ( $this->value !== false )
2182
+        if ($this->value !== false)
2183 2183
         {
2184 2184
             $message = $message ?: $this->overrideError;
2185 2185
             $message = sprintf(
@@ -2201,11 +2201,11 @@  discard block
 block discarded – undo
2201 2201
      */
2202 2202
     public function notFalse($message = null, $propertyPath = null)
2203 2203
     {
2204
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2204
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2205 2205
         {
2206 2206
             return $this;
2207 2207
         }
2208
-        if ( $this->value === false )
2208
+        if ($this->value === false)
2209 2209
         {
2210 2210
             $message = $message ?: $this->overrideError;
2211 2211
             $message = sprintf(
@@ -2227,11 +2227,11 @@  discard block
 block discarded – undo
2227 2227
      */
2228 2228
     public function classExists($message = null, $propertyPath = null)
2229 2229
     {
2230
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2230
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2231 2231
         {
2232 2232
             return $this;
2233 2233
         }
2234
-        if ( !class_exists($this->value) )
2234
+        if ( ! class_exists($this->value))
2235 2235
         {
2236 2236
             $message = $message ?: $this->overrideError;
2237 2237
             $message = sprintf(
@@ -2254,12 +2254,12 @@  discard block
 block discarded – undo
2254 2254
      */
2255 2255
     public function implementsInterface($interfaceName, $message = null, $propertyPath = null)
2256 2256
     {
2257
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2257
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2258 2258
         {
2259 2259
             return $this;
2260 2260
         }
2261 2261
         $reflection = new \ReflectionClass($this->value);
2262
-        if ( !$reflection->implementsInterface($interfaceName) )
2262
+        if ( ! $reflection->implementsInterface($interfaceName))
2263 2263
         {
2264 2264
             $message = $message ?: $this->overrideError;
2265 2265
             $message = sprintf(
@@ -2267,7 +2267,7 @@  discard block
 block discarded – undo
2267 2267
                 $this->stringify($this->value),
2268 2268
                 $this->stringify($interfaceName)
2269 2269
             );
2270
-            throw $this->createException($message, self::INTERFACE_NOT_IMPLEMENTED, $propertyPath, ['interface' => $interfaceName]);
2270
+            throw $this->createException($message, self::INTERFACE_NOT_IMPLEMENTED, $propertyPath, [ 'interface' => $interfaceName ]);
2271 2271
         }
2272 2272
         return $this;
2273 2273
     }
@@ -2288,11 +2288,11 @@  discard block
 block discarded – undo
2288 2288
      */
2289 2289
     public function isJsonString($message = null, $propertyPath = null)
2290 2290
     {
2291
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2291
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2292 2292
         {
2293 2293
             return $this;
2294 2294
         }
2295
-        if ( null === json_decode($this->value) && JSON_ERROR_NONE !== json_last_error() )
2295
+        if (null === json_decode($this->value) && JSON_ERROR_NONE !== json_last_error())
2296 2296
         {
2297 2297
             $message = $message ?: $this->overrideError;
2298 2298
             $message = sprintf(
@@ -2316,16 +2316,16 @@  discard block
 block discarded – undo
2316 2316
      */
2317 2317
     public function uuid($message = null, $propertyPath = null)
2318 2318
     {
2319
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2319
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2320 2320
         {
2321 2321
             return $this;
2322 2322
         }
2323
-        $this->value = str_replace(['urn:', 'uuid:', '{', '}'], '', $this->value);
2324
-        if ( $this->value === '00000000-0000-0000-0000-000000000000' )
2323
+        $this->value = str_replace([ 'urn:', 'uuid:', '{', '}' ], '', $this->value);
2324
+        if ($this->value === '00000000-0000-0000-0000-000000000000')
2325 2325
         {
2326 2326
             return $this;
2327 2327
         }
2328
-        if ( !preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $this->value) )
2328
+        if ( ! preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $this->value))
2329 2329
         {
2330 2330
             $message = $message ?: $this->overrideError;
2331 2331
             $message = sprintf(
@@ -2348,11 +2348,11 @@  discard block
 block discarded – undo
2348 2348
      */
2349 2349
     public function count($count, $message = null, $propertyPath = null)
2350 2350
     {
2351
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2351
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2352 2352
         {
2353 2353
             return $this;
2354 2354
         }
2355
-        if ( $count !== count($this->value) )
2355
+        if ($count !== count($this->value))
2356 2356
         {
2357 2357
             $message = $message ?: $this->overrideError;
2358 2358
             $message = sprintf(
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
                 $this->stringify($this->value),
2361 2361
                 $this->stringify($count)
2362 2362
             );
2363
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $propertyPath, ['count' => $count]);
2363
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $propertyPath, [ 'count' => $count ]);
2364 2364
         }
2365 2365
         return $this;
2366 2366
     }
@@ -2373,24 +2373,24 @@  discard block
 block discarded – undo
2373 2373
      */
2374 2374
     protected function doAllOrNullOr($func, $args)
2375 2375
     {
2376
-        if ( $this->nullOr && is_null($this->value) )
2376
+        if ($this->nullOr && is_null($this->value))
2377 2377
         {
2378 2378
             return true;
2379 2379
         }
2380
-        if ( $this->emptyOr && empty($this->value) )
2380
+        if ($this->emptyOr && empty($this->value))
2381 2381
         {
2382 2382
             return true;
2383 2383
         }
2384
-        if ( $this->all && (new Assert($this->value))->setExceptionClass($this->exceptionClass)->isTraversable() )
2384
+        if ($this->all && (new Assert($this->value))->setExceptionClass($this->exceptionClass)->isTraversable())
2385 2385
         {
2386
-            foreach ( $this->value as $idx => $value )
2386
+            foreach ($this->value as $idx => $value)
2387 2387
             {
2388 2388
                 $object = (new Assert($value))->setExceptionClass($this->exceptionClass);
2389
-                call_user_func_array([$object, $func], $args);
2389
+                call_user_func_array([ $object, $func ], $args);
2390 2390
             }
2391 2391
             return true;
2392 2392
         }
2393
-        return ( $this->nullOr && is_null($this->value) ) || ( $this->emptyOr && empty($this->value) ) ? true : false;
2393
+        return ($this->nullOr && is_null($this->value)) || ($this->emptyOr && empty($this->value)) ? true : false;
2394 2394
     }
2395 2395
 
2396 2396
     /**
@@ -2403,12 +2403,12 @@  discard block
 block discarded – undo
2403 2403
      */
2404 2404
     public function choicesNotEmpty(array $choices, $message = null, $propertyPath = null)
2405 2405
     {
2406
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2406
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2407 2407
         {
2408 2408
             return $this;
2409 2409
         }
2410 2410
         $this->notEmpty($message, $propertyPath);
2411
-        foreach ( $choices as $choice )
2411
+        foreach ($choices as $choice)
2412 2412
         {
2413 2413
             $this->notEmptyKey($choice, $message, $propertyPath);
2414 2414
         }
@@ -2426,12 +2426,12 @@  discard block
 block discarded – undo
2426 2426
      */
2427 2427
     public function methodExists($object, $message = null, $propertyPath = null)
2428 2428
     {
2429
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2429
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2430 2430
         {
2431 2431
             return $this;
2432 2432
         }
2433 2433
         (new Assert($object))->setExceptionClass($this->exceptionClass)->isObject($message, $propertyPath);
2434
-        if ( !method_exists($object, $this->value) )
2434
+        if ( ! method_exists($object, $this->value))
2435 2435
         {
2436 2436
             $message = $message ?: $this->overrideError;
2437 2437
             $message = sprintf(
@@ -2453,11 +2453,11 @@  discard block
 block discarded – undo
2453 2453
      */
2454 2454
     public function isObject($message = null, $propertyPath = null)
2455 2455
     {
2456
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2456
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2457 2457
         {
2458 2458
             return $this;
2459 2459
         }
2460
-        if ( !is_object($this->value) )
2460
+        if ( ! is_object($this->value))
2461 2461
         {
2462 2462
             $message = $message ?: $this->overrideError;
2463 2463
             $message = sprintf(
@@ -2477,32 +2477,32 @@  discard block
 block discarded – undo
2477 2477
      */
2478 2478
     private function stringify($value)
2479 2479
     {
2480
-        if ( is_bool($value) )
2480
+        if (is_bool($value))
2481 2481
         {
2482 2482
             return $value ? '<TRUE>' : '<FALSE>';
2483 2483
         }
2484
-        if ( is_scalar($value) )
2484
+        if (is_scalar($value))
2485 2485
         {
2486 2486
             $val = (string)$value;
2487
-            if ( strlen($val) > 100 )
2487
+            if (strlen($val) > 100)
2488 2488
             {
2489
-                $val = substr($val, 0, 97) . '...';
2489
+                $val = substr($val, 0, 97).'...';
2490 2490
             }
2491 2491
             return $val;
2492 2492
         }
2493
-        if ( is_array($value) )
2493
+        if (is_array($value))
2494 2494
         {
2495 2495
             return '<ARRAY>';
2496 2496
         }
2497
-        if ( is_object($value) )
2497
+        if (is_object($value))
2498 2498
         {
2499 2499
             return get_class($value);
2500 2500
         }
2501
-        if ( is_resource($value) )
2501
+        if (is_resource($value))
2502 2502
         {
2503 2503
             return '<RESOURCE>';
2504 2504
         }
2505
-        if ( $value === null )
2505
+        if ($value === null)
2506 2506
         {
2507 2507
             return '<NULL>';
2508 2508
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1972,8 +1972,7 @@  discard block
 block discarded – undo
1972 1972
                 $this->stringify($this->value)
1973 1973
             );
1974 1974
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_EMAIL, $propertyPath);
1975
-        }
1976
-        else
1975
+        } else
1977 1976
         {
1978 1977
             $host = substr($this->value, strpos($this->value, '@') + 1);
1979 1978
             // Likely not a FQDN, bug in PHP FILTER_VALIDATE_EMAIL prior to PHP 5.3.3
@@ -2099,8 +2098,7 @@  discard block
 block discarded – undo
2099 2098
         try
2100 2099
         {
2101 2100
             $this->regex('(^([a-zA-Z]{1}[a-zA-Z0-9]*)$)', $message, $propertyPath);
2102
-        }
2103
-        catch (AssertionFailedException $e)
2101
+        } catch (AssertionFailedException $e)
2104 2102
         {
2105 2103
             $message = $message ?: $this->overrideError;
2106 2104
             $message = sprintf(
Please login to merge, or discard this patch.