Completed
Push — master ( 9f6592...da81a2 )
by Terry
04:12
created
src/Assert.php 2 patches
Spacing   +225 added lines, -225 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
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      *
132 132
      * @var string
133 133
      */
134
-    protected $exceptionClass           = 'Terah\Assert\AssertionFailedException';
134
+    protected $exceptionClass = 'Terah\Assert\AssertionFailedException';
135 135
 
136 136
     /**
137 137
      * @param mixed $value
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public static function runValidators(array $validators) : array
150 150
     {
151
-        $errors = [];
152
-        foreach ( $validators as $fieldName => $validator )
151
+        $errors = [ ];
152
+        foreach ($validators as $fieldName => $validator)
153 153
         {
154 154
             try
155 155
             {
156 156
                 $validator->__invoke();
157 157
             }
158
-            catch ( AssertionFailedException $e )
158
+            catch (AssertionFailedException $e)
159 159
             {
160
-                $errors[$fieldName]     = $e->getMessage();
160
+                $errors[ $fieldName ] = $e->getMessage();
161 161
             }
162 162
         }
163 163
 
@@ -172,22 +172,22 @@  discard block
 block discarded – undo
172 172
      * @param string $level
173 173
      * @return Assert
174 174
      */
175
-    public static function that($value, $name='', $code=0, $error='', $level=Assert::WARNING)
175
+    public static function that($value, $name = '', $code = 0, $error = '', $level = Assert::WARNING)
176 176
     {
177 177
         $assert = new static($value);
178
-        if ( $name )
178
+        if ($name)
179 179
         {
180 180
             $assert->name($name);
181 181
         }
182
-        if ( $code )
182
+        if ($code)
183 183
         {
184 184
             $assert->code($code);
185 185
         }
186
-        if ( $error )
186
+        if ($error)
187 187
         {
188 188
             $assert->error($error);
189 189
         }
190
-        if ( $level )
190
+        if ($level)
191 191
         {
192 192
             $assert->level($level);
193 193
         }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      * @param string $level
257 257
      * @return AssertionFailedException
258 258
      */
259
-    protected function createException($message, $code, $propertyPath, array $constraints = [], $level=null)
259
+    protected function createException($message, $code, $propertyPath, array $constraints = [ ], $level = null)
260 260
     {
261 261
         $exceptionClass = $this->exceptionClass;
262 262
         $propertyPath   = is_null($propertyPath) ? $this->propertyPath : $propertyPath;
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
      */
327 327
     public function eq($value2, $message = null, $propertyPath = null)
328 328
     {
329
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
329
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
330 330
         {
331 331
             return $this;
332 332
         }
333
-        if ( $this->value != $value2 )
333
+        if ($this->value != $value2)
334 334
         {
335 335
             $message = $message ?: $this->overrideError;
336 336
             $message = sprintf(
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
                 $this->stringify($this->value),
339 339
                 $this->stringify($value2)
340 340
             );
341
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]);
341
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, [ 'expected' => $value2 ]);
342 342
         }
343 343
         return $this;
344 344
     }
@@ -353,11 +353,11 @@  discard block
 block discarded – undo
353 353
      */
354 354
     public function greaterThan($value2, $message = null, $propertyPath = null)
355 355
     {
356
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
356
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
357 357
         {
358 358
             return $this;
359 359
         }
360
-        if ( ! ( $this->value > $value2 ) )
360
+        if ( ! ($this->value > $value2))
361 361
         {
362 362
             $message = $message ?: $this->overrideError;
363 363
             $message = sprintf(
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                 $this->stringify($this->value),
366 366
                 $this->stringify($value2)
367 367
             );
368
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]);
368
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, [ 'expected' => $value2 ]);
369 369
         }
370 370
         return $this;
371 371
     }
@@ -380,11 +380,11 @@  discard block
 block discarded – undo
380 380
      */
381 381
     public function greaterThanOrEq($value2, $message = null, $propertyPath = null)
382 382
     {
383
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
383
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
384 384
         {
385 385
             return $this;
386 386
         }
387
-        if ( ! ( $this->value >= $value2 ) )
387
+        if ( ! ($this->value >= $value2))
388 388
         {
389 389
             $message = $message ?: $this->overrideError;
390 390
             $message = sprintf(
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
                 $this->stringify($this->value),
393 393
                 $this->stringify($value2)
394 394
             );
395
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]);
395
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, [ 'expected' => $value2 ]);
396 396
         }
397 397
         return $this;
398 398
     }
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
      */
408 408
     public function lessThan($value2, $message = null, $propertyPath = null)
409 409
     {
410
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
410
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
411 411
         {
412 412
             return $this;
413 413
         }
414
-        if ( ! ( $this->value < $value2 ) )
414
+        if ( ! ($this->value < $value2))
415 415
         {
416 416
             $message = $message ?: $this->overrideError;
417 417
             $message = sprintf(
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
                 $this->stringify($this->value),
420 420
                 $this->stringify($value2)
421 421
             );
422
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $propertyPath, ['expected' => $value2]);
422
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $propertyPath, [ 'expected' => $value2 ]);
423 423
         }
424 424
         return $this;
425 425
     }
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
      */
435 435
     public function lessThanOrEq($value2, $message = null, $propertyPath = null)
436 436
     {
437
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
437
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
438 438
         {
439 439
             return $this;
440 440
         }
441
-        if ( ! ( $this->value <= $value2 ) )
441
+        if ( ! ($this->value <= $value2))
442 442
         {
443 443
             $message = $message ?: $this->overrideError;
444 444
             $message = sprintf(
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
                 $this->stringify($this->value),
447 447
                 $this->stringify($value2)
448 448
             );
449
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $propertyPath, ['expected' => $value2]);
449
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $propertyPath, [ 'expected' => $value2 ]);
450 450
         }
451 451
         return $this;
452 452
     }
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
      */
463 463
     public function same($value2, $message = null, $propertyPath = null)
464 464
     {
465
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
465
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
466 466
         {
467 467
             return $this;
468 468
         }
469
-        if ( $this->value !== $value2 )
469
+        if ($this->value !== $value2)
470 470
         {
471 471
             $message = $message ?: $this->overrideError;
472 472
             $message = sprintf(
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
                 $this->stringify($this->value),
475 475
                 $this->stringify($value2)
476 476
             );
477
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $propertyPath, ['expected' => $value2]);
477
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $propertyPath, [ 'expected' => $value2 ]);
478 478
         }
479 479
         return $this;
480 480
     }
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
      */
491 491
     public function notEq($value2, $message = null, $propertyPath = null)
492 492
     {
493
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
493
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
494 494
         {
495 495
             return $this;
496 496
         }
497
-        if ( $this->value == $value2 )
497
+        if ($this->value == $value2)
498 498
         {
499 499
             $message = $message ?: $this->overrideError;
500 500
             $message = sprintf(
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
                 $this->stringify($this->value),
503 503
                 $this->stringify($value2)
504 504
             );
505
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $propertyPath, ['expected' => $value2]);
505
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $propertyPath, [ 'expected' => $value2 ]);
506 506
         }
507 507
         return $this;
508 508
     }
@@ -516,11 +516,11 @@  discard block
 block discarded – undo
516 516
      */
517 517
     public function isCallable($message = null, $propertyPath = null)
518 518
     {
519
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
519
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
520 520
         {
521 521
             return $this;
522 522
         }
523
-        if ( !is_callable($this->value) )
523
+        if ( ! is_callable($this->value))
524 524
         {
525 525
             $message = $message ?: $this->overrideError;
526 526
             $message = sprintf(
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
      */
544 544
     public function notSame($value2, $message = null, $propertyPath = null)
545 545
     {
546
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
546
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
547 547
         {
548 548
             return $this;
549 549
         }
550
-        if ( $this->value === $value2 )
550
+        if ($this->value === $value2)
551 551
         {
552 552
             $message = $message ?: $this->overrideError;
553 553
             $message = sprintf(
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
                 $this->stringify($this->value),
556 556
                 $this->stringify($value2)
557 557
             );
558
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $propertyPath, ['expected' => $value2]);
558
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $propertyPath, [ 'expected' => $value2 ]);
559 559
         }
560 560
         return $this;
561 561
     }
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
      * @return Assert
580 580
      * @throws AssertionFailedException
581 581
      */
582
-    public function unsignedInt($message=null, $propertyPath=null)
582
+    public function unsignedInt($message = null, $propertyPath = null)
583 583
     {
584 584
         $message = $message ?: $this->overrideError;
585 585
         $message = $message ?: 'Value "%s" is not an integer id.';
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
     {
611 611
         $message = $message ?: $this->overrideError;
612 612
         $message = $message ?: 'Value "%s" is not a valid status.';
613
-        return $this->integer($message, $propertyPath)->inArray([-1, 0, 1]);
613
+        return $this->integer($message, $propertyPath)->inArray([-1, 0, 1 ]);
614 614
     }
615 615
 
616 616
     /**
@@ -654,11 +654,11 @@  discard block
 block discarded – undo
654 654
      */
655 655
     public function integer($message = null, $propertyPath = null)
656 656
     {
657
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
657
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
658 658
         {
659 659
             return $this;
660 660
         }
661
-        if ( !is_int($this->value) )
661
+        if ( ! is_int($this->value))
662 662
         {
663 663
             $message = $message ?: $this->overrideError;
664 664
             $message = sprintf(
@@ -680,11 +680,11 @@  discard block
 block discarded – undo
680 680
      */
681 681
     public function float($message = null, $propertyPath = null)
682 682
     {
683
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
683
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
684 684
         {
685 685
             return $this;
686 686
         }
687
-        if ( ! is_float($this->value) )
687
+        if ( ! is_float($this->value))
688 688
         {
689 689
             $message = $message ?: $this->overrideError;
690 690
             $message = sprintf(
@@ -706,11 +706,11 @@  discard block
 block discarded – undo
706 706
      */
707 707
     public function digit($message = null, $propertyPath = null)
708 708
     {
709
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
709
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
710 710
         {
711 711
             return $this;
712 712
         }
713
-        if ( ! ctype_digit((string)$this->value) )
713
+        if ( ! ctype_digit((string)$this->value))
714 714
         {
715 715
             $message = $message ?: $this->overrideError;
716 716
             $message = sprintf(
@@ -732,12 +732,12 @@  discard block
 block discarded – undo
732 732
      */
733 733
     public function date($message = null, $propertyPath = null)
734 734
     {
735
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
735
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
736 736
         {
737 737
             return $this;
738 738
         }
739 739
         $this->notEmpty($message, $propertyPath);
740
-        if ( strtotime($this->value) === false )
740
+        if (strtotime($this->value) === false)
741 741
         {
742 742
             $message = $message ?: $this->overrideError;
743 743
             $message = sprintf(
@@ -759,11 +759,11 @@  discard block
 block discarded – undo
759 759
      */
760 760
     public function integerish($message = null, $propertyPath = null)
761 761
     {
762
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
762
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
763 763
         {
764 764
             return $this;
765 765
         }
766
-        if ( is_object($this->value) || strval(intval($this->value)) != $this->value || is_bool($this->value) || is_null($this->value) )
766
+        if (is_object($this->value) || strval(intval($this->value)) != $this->value || is_bool($this->value) || is_null($this->value))
767 767
         {
768 768
             $message = $message ?: $this->overrideError;
769 769
             $message = sprintf(
@@ -785,11 +785,11 @@  discard block
 block discarded – undo
785 785
      */
786 786
     public function boolean($message = null, $propertyPath = null)
787 787
     {
788
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
788
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
789 789
         {
790 790
             return $this;
791 791
         }
792
-        if ( ! is_bool($this->value) )
792
+        if ( ! is_bool($this->value))
793 793
         {
794 794
             $message = $message ?: $this->overrideError;
795 795
             $message = sprintf(
@@ -811,11 +811,11 @@  discard block
 block discarded – undo
811 811
      */
812 812
     public function scalar($message = null, $propertyPath = null)
813 813
     {
814
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
814
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
815 815
         {
816 816
             return $this;
817 817
         }
818
-        if ( ! is_scalar($this->value) )
818
+        if ( ! is_scalar($this->value))
819 819
         {
820 820
             $message = $message ?: $this->overrideError;
821 821
             $message = sprintf(
@@ -837,11 +837,11 @@  discard block
 block discarded – undo
837 837
      */
838 838
     public function notEmpty($message = null, $propertyPath = null)
839 839
     {
840
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
840
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
841 841
         {
842 842
             return $this;
843 843
         }
844
-        if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) )
844
+        if ((is_object($this->value) && empty((array)$this->value)) || empty($this->value))
845 845
         {
846 846
             $message = $message ?: $this->overrideError;
847 847
             $message = sprintf(
@@ -863,11 +863,11 @@  discard block
 block discarded – undo
863 863
      */
864 864
     public function noContent($message = null, $propertyPath = null)
865 865
     {
866
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
866
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
867 867
         {
868 868
             return $this;
869 869
         }
870
-        if ( !empty( $this->value ) )
870
+        if ( ! empty($this->value))
871 871
         {
872 872
             $message = $message ?: $this->overrideError;
873 873
             $message = sprintf(
@@ -889,11 +889,11 @@  discard block
 block discarded – undo
889 889
      */
890 890
     public function notNull($message = null, $propertyPath = null)
891 891
     {
892
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
892
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
893 893
         {
894 894
             return $this;
895 895
         }
896
-        if ( $this->value === null )
896
+        if ($this->value === null)
897 897
         {
898 898
             $message = $message ?: $this->overrideError;
899 899
             $message = sprintf(
@@ -915,11 +915,11 @@  discard block
 block discarded – undo
915 915
      */
916 916
     public function string($message = null, $propertyPath = null)
917 917
     {
918
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
918
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
919 919
         {
920 920
             return $this;
921 921
         }
922
-        if ( !is_string($this->value) )
922
+        if ( ! is_string($this->value))
923 923
         {
924 924
             $message = $message ?: $this->overrideError;
925 925
             $message = sprintf(
@@ -941,21 +941,21 @@  discard block
 block discarded – undo
941 941
      * @return Assert
942 942
      * @throws AssertionFailedException
943 943
      */
944
-    public function regex($pattern, $message=null, $propertyPath=null)
944
+    public function regex($pattern, $message = null, $propertyPath = null)
945 945
     {
946
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
946
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
947 947
         {
948 948
             return $this;
949 949
         }
950 950
         $this->string($message, $propertyPath);
951
-        if ( ! preg_match($pattern, $this->value) )
951
+        if ( ! preg_match($pattern, $this->value))
952 952
         {
953 953
             $message = $message ?: $this->overrideError;
954 954
             $message = sprintf(
955 955
                 $message ?: 'Value "%s" does not match expression.',
956 956
                 $this->stringify($this->value)
957 957
             );
958
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]);
958
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, [ 'pattern' => $pattern ]);
959 959
         }
960 960
         return $this;
961 961
     }
@@ -968,13 +968,13 @@  discard block
 block discarded – undo
968 968
      */
969 969
     public function ipAddress($message = null, $propertyPath = null)
970 970
     {
971
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
971
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
972 972
         {
973 973
             return $this;
974 974
         }
975 975
         $this->string($message, $propertyPath);
976
-        $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])$/';
977
-        if ( ! preg_match($pattern, $this->value) )
976
+        $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])$/';
977
+        if ( ! preg_match($pattern, $this->value))
978 978
         {
979 979
             $message = $message ?: $this->overrideError;
980 980
             $message = sprintf(
@@ -995,19 +995,19 @@  discard block
 block discarded – undo
995 995
      */
996 996
     public function notRegex($pattern, $message = null, $propertyPath = null)
997 997
     {
998
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
998
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
999 999
         {
1000 1000
             return $this;
1001 1001
         }
1002 1002
         $this->string($message, $propertyPath);
1003
-        if ( preg_match($pattern, $this->value) )
1003
+        if (preg_match($pattern, $this->value))
1004 1004
         {
1005 1005
             $message = $message ?: $this->overrideError;
1006 1006
             $message = sprintf(
1007 1007
                 $message ?: 'Value "%s" does not match expression.',
1008 1008
                 $this->stringify($this->value)
1009 1009
             );
1010
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]);
1010
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, [ 'pattern' => $pattern ]);
1011 1011
         }
1012 1012
         return $this;
1013 1013
     }
@@ -1024,12 +1024,12 @@  discard block
 block discarded – undo
1024 1024
      */
1025 1025
     public function length($length, $message = null, $propertyPath = null, $encoding = 'utf8')
1026 1026
     {
1027
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1027
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1028 1028
         {
1029 1029
             return $this;
1030 1030
         }
1031 1031
         $this->string($message, $propertyPath);
1032
-        if ( mb_strlen($this->value, $encoding) !== $length )
1032
+        if (mb_strlen($this->value, $encoding) !== $length)
1033 1033
         {
1034 1034
             $message    = $message ?: $this->overrideError;
1035 1035
             $message    = sprintf(
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
                 $length,
1039 1039
                 mb_strlen($this->value, $encoding)
1040 1040
             );
1041
-            $constraints = ['length' => $length, 'encoding' => $encoding];
1041
+            $constraints = [ 'length' => $length, 'encoding' => $encoding ];
1042 1042
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_LENGTH, $propertyPath, $constraints);
1043 1043
         }
1044 1044
         return $this;
@@ -1056,22 +1056,22 @@  discard block
 block discarded – undo
1056 1056
      */
1057 1057
     public function minLength($minLength, $message = null, $propertyPath = null, $encoding = 'utf8')
1058 1058
     {
1059
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1059
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1060 1060
         {
1061 1061
             return $this;
1062 1062
         }
1063 1063
         $this->string($message, $propertyPath);
1064
-        if ( mb_strlen($this->value, $encoding) < $minLength )
1064
+        if (mb_strlen($this->value, $encoding) < $minLength)
1065 1065
         {
1066 1066
             $message = $message ?: $this->overrideError;
1067
-            $message     = sprintf(
1067
+            $message = sprintf(
1068 1068
                 $message
1069 1069
                     ?: 'Value "%s" is too short, it should have more than %d characters, but only has %d characters.',
1070 1070
                 $this->stringify($this->value),
1071 1071
                 $minLength,
1072 1072
                 mb_strlen($this->value, $encoding)
1073 1073
             );
1074
-            $constraints = ['min_length' => $minLength, 'encoding' => $encoding];
1074
+            $constraints = [ 'min_length' => $minLength, 'encoding' => $encoding ];
1075 1075
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN_LENGTH, $propertyPath, $constraints);
1076 1076
         }
1077 1077
         return $this;
@@ -1089,21 +1089,21 @@  discard block
 block discarded – undo
1089 1089
      */
1090 1090
     public function maxLength($maxLength, $message = null, $propertyPath = null, $encoding = 'utf8')
1091 1091
     {
1092
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1092
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1093 1093
         {
1094 1094
             return $this;
1095 1095
         }
1096 1096
         $this->string($message, $propertyPath);
1097
-        if ( mb_strlen($this->value, $encoding) > $maxLength )
1097
+        if (mb_strlen($this->value, $encoding) > $maxLength)
1098 1098
         {
1099 1099
             $message = $message ?: $this->overrideError;
1100
-            $message     = sprintf(
1100
+            $message = sprintf(
1101 1101
                 $message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.',
1102 1102
                 $this->stringify($this->value),
1103 1103
                 $maxLength,
1104 1104
                 mb_strlen($this->value, $encoding)
1105 1105
             );
1106
-            $constraints = ['max_length' => $maxLength, 'encoding' => $encoding];
1106
+            $constraints = [ 'max_length' => $maxLength, 'encoding' => $encoding ];
1107 1107
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX_LENGTH, $propertyPath, $constraints);
1108 1108
         }
1109 1109
         return $this;
@@ -1122,34 +1122,34 @@  discard block
 block discarded – undo
1122 1122
      */
1123 1123
     public function betweenLength($minLength, $maxLength, $message = null, $propertyPath = null, $encoding = 'utf8')
1124 1124
     {
1125
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1125
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1126 1126
         {
1127 1127
             return $this;
1128 1128
         }
1129 1129
         $this->string($message, $propertyPath);
1130
-        if ( mb_strlen($this->value, $encoding) < $minLength )
1130
+        if (mb_strlen($this->value, $encoding) < $minLength)
1131 1131
         {
1132 1132
             $message = $message ?: $this->overrideError;
1133
-            $message     = sprintf(
1133
+            $message = sprintf(
1134 1134
                 $message
1135 1135
                     ?: 'Value "%s" is too short, it should have more than %d characters, but only has %d characters.',
1136 1136
                 $this->stringify($this->value),
1137 1137
                 $minLength,
1138 1138
                 mb_strlen($this->value, $encoding)
1139 1139
             );
1140
-            $constraints = ['min_length' => $minLength, 'encoding' => $encoding];
1140
+            $constraints = [ 'min_length' => $minLength, 'encoding' => $encoding ];
1141 1141
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN_LENGTH, $propertyPath, $constraints);
1142 1142
         }
1143
-        if ( mb_strlen($this->value, $encoding) > $maxLength )
1143
+        if (mb_strlen($this->value, $encoding) > $maxLength)
1144 1144
         {
1145 1145
             $message = $message ?: $this->overrideError;
1146
-            $message     = sprintf(
1146
+            $message = sprintf(
1147 1147
                 $message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.',
1148 1148
                 $this->stringify($this->value),
1149 1149
                 $maxLength,
1150 1150
                 mb_strlen($this->value, $encoding)
1151 1151
             );
1152
-            $constraints = ['max_length' => $maxLength, 'encoding' => $encoding];
1152
+            $constraints = [ 'max_length' => $maxLength, 'encoding' => $encoding ];
1153 1153
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX_LENGTH, $propertyPath, $constraints);
1154 1154
         }
1155 1155
         return $this;
@@ -1167,20 +1167,20 @@  discard block
 block discarded – undo
1167 1167
      */
1168 1168
     public function startsWith($needle, $message = null, $propertyPath = null, $encoding = 'utf8')
1169 1169
     {
1170
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1170
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1171 1171
         {
1172 1172
             return $this;
1173 1173
         }
1174 1174
         $this->string($message, $propertyPath);
1175
-        if ( mb_strpos($this->value, $needle, null, $encoding) !== 0 )
1175
+        if (mb_strpos($this->value, $needle, null, $encoding) !== 0)
1176 1176
         {
1177 1177
             $message = $message ?: $this->overrideError;
1178
-            $message     = sprintf(
1178
+            $message = sprintf(
1179 1179
                 $message ?: 'Value "%s" does not start with "%s".',
1180 1180
                 $this->stringify($this->value),
1181 1181
                 $this->stringify($needle)
1182 1182
             );
1183
-            $constraints = ['needle' => $needle, 'encoding' => $encoding];
1183
+            $constraints = [ 'needle' => $needle, 'encoding' => $encoding ];
1184 1184
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_START, $propertyPath, $constraints);
1185 1185
         }
1186 1186
         return $this;
@@ -1198,21 +1198,21 @@  discard block
 block discarded – undo
1198 1198
      */
1199 1199
     public function endsWith($needle, $message = null, $propertyPath = null, $encoding = 'utf8')
1200 1200
     {
1201
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1201
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1202 1202
         {
1203 1203
             return $this;
1204 1204
         }
1205 1205
         $this->string($message, $propertyPath);
1206 1206
         $stringPosition = mb_strlen($this->value, $encoding) - mb_strlen($needle, $encoding);
1207
-        if ( mb_strripos($this->value, $needle, null, $encoding) !== $stringPosition )
1207
+        if (mb_strripos($this->value, $needle, null, $encoding) !== $stringPosition)
1208 1208
         {
1209 1209
             $message = $message ?: $this->overrideError;
1210
-            $message     = sprintf(
1210
+            $message = sprintf(
1211 1211
                 $message ?: 'Value "%s" does not end with "%s".',
1212 1212
                 $this->stringify($this->value),
1213 1213
                 $this->stringify($needle)
1214 1214
             );
1215
-            $constraints = ['needle' => $needle, 'encoding' => $encoding];
1215
+            $constraints = [ 'needle' => $needle, 'encoding' => $encoding ];
1216 1216
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_END, $propertyPath, $constraints);
1217 1217
         }
1218 1218
         return $this;
@@ -1230,20 +1230,20 @@  discard block
 block discarded – undo
1230 1230
      */
1231 1231
     public function contains($needle, $message = null, $propertyPath = null, $encoding = 'utf8')
1232 1232
     {
1233
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1233
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1234 1234
         {
1235 1235
             return $this;
1236 1236
         }
1237 1237
         $this->string($message, $propertyPath);
1238
-        if ( mb_strpos($this->value, $needle, null, $encoding) === false )
1238
+        if (mb_strpos($this->value, $needle, null, $encoding) === false)
1239 1239
         {
1240 1240
             $message = $message ?: $this->overrideError;
1241
-            $message     = sprintf(
1241
+            $message = sprintf(
1242 1242
                 $message ?: 'Value "%s" does not contain "%s".',
1243 1243
                 $this->stringify($this->value),
1244 1244
                 $this->stringify($needle)
1245 1245
             );
1246
-            $constraints = ['needle' => $needle, 'encoding' => $encoding];
1246
+            $constraints = [ 'needle' => $needle, 'encoding' => $encoding ];
1247 1247
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_CONTAINS, $propertyPath, $constraints);
1248 1248
         }
1249 1249
         return $this;
@@ -1260,11 +1260,11 @@  discard block
 block discarded – undo
1260 1260
      */
1261 1261
     public function choice(array $choices, $message = null, $propertyPath = null)
1262 1262
     {
1263
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1263
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1264 1264
         {
1265 1265
             return $this;
1266 1266
         }
1267
-        if ( !in_array($this->value, $choices, true) )
1267
+        if ( ! in_array($this->value, $choices, true))
1268 1268
         {
1269 1269
             $message = $message ?: $this->overrideError;
1270 1270
             $message = sprintf(
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
                 $this->stringify($this->value),
1273 1273
                 implode(", ", array_map('Terah\Assert\Assert::stringify', $choices))
1274 1274
             );
1275
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_CHOICE, $propertyPath, ['choices' => $choices]);
1275
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_CHOICE, $propertyPath, [ 'choices' => $choices ]);
1276 1276
         }
1277 1277
         return $this;
1278 1278
     }
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
      */
1290 1290
     public function inArray(array $choices, $message = null, $propertyPath = null)
1291 1291
     {
1292
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1292
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1293 1293
         {
1294 1294
             return $this;
1295 1295
         }
@@ -1307,11 +1307,11 @@  discard block
 block discarded – undo
1307 1307
      */
1308 1308
     public function numeric($message = null, $propertyPath = null)
1309 1309
     {
1310
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1310
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1311 1311
         {
1312 1312
             return $this;
1313 1313
         }
1314
-        if ( ! is_numeric($this->value) )
1314
+        if ( ! is_numeric($this->value))
1315 1315
         {
1316 1316
             $message = $message ?: $this->overrideError;
1317 1317
             $message = sprintf(
@@ -1369,11 +1369,11 @@  discard block
 block discarded – undo
1369 1369
      */
1370 1370
     public function isArray($message = null, $propertyPath = null)
1371 1371
     {
1372
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1372
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1373 1373
         {
1374 1374
             return $this;
1375 1375
         }
1376
-        if ( !is_array($this->value) )
1376
+        if ( ! is_array($this->value))
1377 1377
         {
1378 1378
             $message = $message ?: $this->overrideError;
1379 1379
             $message = sprintf(
@@ -1395,11 +1395,11 @@  discard block
 block discarded – undo
1395 1395
      */
1396 1396
     public function isTraversable($message = null, $propertyPath = null)
1397 1397
     {
1398
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1398
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1399 1399
         {
1400 1400
             return $this;
1401 1401
         }
1402
-        if ( !is_array($this->value) && !$this->value instanceof \Traversable )
1402
+        if ( ! is_array($this->value) && ! $this->value instanceof \Traversable)
1403 1403
         {
1404 1404
             $message = $message ?: $this->overrideError;
1405 1405
             $message = sprintf(
@@ -1421,11 +1421,11 @@  discard block
 block discarded – undo
1421 1421
      */
1422 1422
     public function isArrayAccessible($message = null, $propertyPath = null)
1423 1423
     {
1424
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1424
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1425 1425
         {
1426 1426
             return $this;
1427 1427
         }
1428
-        if ( !is_array($this->value) && !$this->value instanceof \ArrayAccess )
1428
+        if ( ! is_array($this->value) && ! $this->value instanceof \ArrayAccess)
1429 1429
         {
1430 1430
             $message = $message ?: $this->overrideError;
1431 1431
             $message = sprintf(
@@ -1448,19 +1448,19 @@  discard block
 block discarded – undo
1448 1448
      */
1449 1449
     public function keyExists($key, $message = null, $propertyPath = null)
1450 1450
     {
1451
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1451
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1452 1452
         {
1453 1453
             return $this;
1454 1454
         }
1455 1455
         $this->isArray($message, $propertyPath);
1456
-        if ( !array_key_exists($key, $this->value) )
1456
+        if ( ! array_key_exists($key, $this->value))
1457 1457
         {
1458 1458
             $message = $message ?: $this->overrideError;
1459 1459
             $message = sprintf(
1460 1460
                 $message ?: 'Array does not contain an element with key "%s"',
1461 1461
                 $this->stringify($key)
1462 1462
             );
1463
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_EXISTS, $propertyPath, ['key' => $key]);
1463
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_EXISTS, $propertyPath, [ 'key' => $key ]);
1464 1464
         }
1465 1465
         return $this;
1466 1466
     }
@@ -1476,21 +1476,21 @@  discard block
 block discarded – undo
1476 1476
      */
1477 1477
     public function keysExist($keys, $message = null, $propertyPath = null)
1478 1478
     {
1479
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1479
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1480 1480
         {
1481 1481
             return $this;
1482 1482
         }
1483 1483
         $this->isArray($message, $propertyPath);
1484
-        foreach ( $keys as $key )
1484
+        foreach ($keys as $key)
1485 1485
         {
1486
-            if ( !array_key_exists($key, $this->value) )
1486
+            if ( ! array_key_exists($key, $this->value))
1487 1487
             {
1488 1488
                 $message = $message
1489 1489
                     ?: sprintf(
1490 1490
                         'Array does not contain an element with key "%s"',
1491 1491
                         $this->stringify($key)
1492 1492
                     );
1493
-                throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEYS_EXIST, $propertyPath, ['key' => $key]);
1493
+                throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEYS_EXIST, $propertyPath, [ 'key' => $key ]);
1494 1494
             }
1495 1495
         }
1496 1496
         return $this;
@@ -1507,19 +1507,19 @@  discard block
 block discarded – undo
1507 1507
      */
1508 1508
     public function propertyExists($key, $message = null, $propertyPath = null)
1509 1509
     {
1510
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1510
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1511 1511
         {
1512 1512
             return $this;
1513 1513
         }
1514 1514
         $this->isObject($message, $propertyPath);
1515
-        if ( !property_exists($this->value, $key) && !isset( $this->value->{$key} ) )
1515
+        if ( ! property_exists($this->value, $key) && ! isset($this->value->{$key} ))
1516 1516
         {
1517 1517
             $message = $message
1518 1518
                 ?: sprintf(
1519 1519
                     'Object does not contain a property with key "%s"',
1520 1520
                     $this->stringify($key)
1521 1521
                 );
1522
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTY_EXISTS, $propertyPath, ['key' => $key]);
1522
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTY_EXISTS, $propertyPath, [ 'key' => $key ]);
1523 1523
         }
1524 1524
         return $this;
1525 1525
     }
@@ -1535,22 +1535,22 @@  discard block
 block discarded – undo
1535 1535
      */
1536 1536
     public function propertiesExist(array $keys, $message = null, $propertyPath = null)
1537 1537
     {
1538
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1538
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1539 1539
         {
1540 1540
             return $this;
1541 1541
         }
1542 1542
         $this->isObject($message, $propertyPath);
1543
-        foreach ( $keys as $key )
1543
+        foreach ($keys as $key)
1544 1544
         {
1545 1545
             // Using isset to allow resolution of magically defined properties
1546
-            if ( !property_exists($this->value, $key) && !isset( $this->value->{$key} ) )
1546
+            if ( ! property_exists($this->value, $key) && ! isset($this->value->{$key} ))
1547 1547
             {
1548 1548
                 $message = $message
1549 1549
                     ?: sprintf(
1550 1550
                         'Object does not contain a property with key "%s"',
1551 1551
                         $this->stringify($key)
1552 1552
                     );
1553
-                throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTIES_EXIST, $propertyPath, ['key' => $key]);
1553
+                throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTIES_EXIST, $propertyPath, [ 'key' => $key ]);
1554 1554
             }
1555 1555
         }
1556 1556
         return $this;
@@ -1566,12 +1566,12 @@  discard block
 block discarded – undo
1566 1566
      */
1567 1567
     public function utf8($message = null, $propertyPath = null)
1568 1568
     {
1569
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1569
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1570 1570
         {
1571 1571
             return $this;
1572 1572
         }
1573 1573
         $this->string($message, $propertyPath);
1574
-        if ( mb_detect_encoding($this->value, 'UTF-8', true) !== 'UTF-8' )
1574
+        if (mb_detect_encoding($this->value, 'UTF-8', true) !== 'UTF-8')
1575 1575
         {
1576 1576
             $message = $message
1577 1577
                 ?: sprintf(
@@ -1594,12 +1594,12 @@  discard block
 block discarded – undo
1594 1594
      */
1595 1595
     public function ascii($message = null, $propertyPath = null)
1596 1596
     {
1597
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1597
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1598 1598
         {
1599 1599
             return $this;
1600 1600
         }
1601 1601
         $this->string($message, $propertyPath);
1602
-        if ( ! preg_match('/^[ -~]+$/', $this->value) )
1602
+        if ( ! preg_match('/^[ -~]+$/', $this->value))
1603 1603
         {
1604 1604
             $message = $message
1605 1605
                 ?: sprintf(
@@ -1622,19 +1622,19 @@  discard block
 block discarded – undo
1622 1622
      */
1623 1623
     public function keyIsset($key, $message = null, $propertyPath = null)
1624 1624
     {
1625
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1625
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1626 1626
         {
1627 1627
             return $this;
1628 1628
         }
1629 1629
         $this->isArrayAccessible($message, $propertyPath);
1630
-        if ( !isset( $this->value[$key] ) )
1630
+        if ( ! isset($this->value[ $key ]))
1631 1631
         {
1632 1632
             $message = $message ?: $this->overrideError;
1633 1633
             $message = sprintf(
1634 1634
                 $message ?: 'The element with key "%s" was not found',
1635 1635
                 $this->stringify($key)
1636 1636
             );
1637
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_ISSET, $propertyPath, ['key' => $key]);
1637
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_ISSET, $propertyPath, [ 'key' => $key ]);
1638 1638
         }
1639 1639
         return $this;
1640 1640
     }
@@ -1650,12 +1650,12 @@  discard block
 block discarded – undo
1650 1650
      */
1651 1651
     public function notEmptyKey($key, $message = null, $propertyPath = null)
1652 1652
     {
1653
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1653
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1654 1654
         {
1655 1655
             return $this;
1656 1656
         }
1657 1657
         $this->keyIsset($key, $message, $propertyPath);
1658
-        (new Assert($this->value[$key]))->setExceptionClass($this->exceptionClass)->notEmpty($message, $propertyPath);
1658
+        (new Assert($this->value[ $key ]))->setExceptionClass($this->exceptionClass)->notEmpty($message, $propertyPath);
1659 1659
         return $this;
1660 1660
     }
1661 1661
 
@@ -1669,11 +1669,11 @@  discard block
 block discarded – undo
1669 1669
      */
1670 1670
     public function notBlank($message = null, $propertyPath = null)
1671 1671
     {
1672
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1672
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1673 1673
         {
1674 1674
             return $this;
1675 1675
         }
1676
-        if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) )
1676
+        if (false === $this->value || (empty($this->value) && '0' != $this->value))
1677 1677
         {
1678 1678
             $message = $message ?: $this->overrideError;
1679 1679
             $message = sprintf(
@@ -1696,11 +1696,11 @@  discard block
 block discarded – undo
1696 1696
      */
1697 1697
     public function isInstanceOf($className, $message = null, $propertyPath = null)
1698 1698
     {
1699
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1699
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1700 1700
         {
1701 1701
             return $this;
1702 1702
         }
1703
-        if ( !( $this->value instanceof $className ) )
1703
+        if ( ! ($this->value instanceof $className))
1704 1704
         {
1705 1705
             $message = $message ?: $this->overrideError;
1706 1706
             $message = sprintf(
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
                 $this->stringify($this->value),
1709 1709
                 $className
1710 1710
             );
1711
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $propertyPath, ['class' => $className]);
1711
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $propertyPath, [ 'class' => $className ]);
1712 1712
         }
1713 1713
         return $this;
1714 1714
     }
@@ -1724,11 +1724,11 @@  discard block
 block discarded – undo
1724 1724
      */
1725 1725
     public function notIsInstanceOf($className, $message = null, $propertyPath = null)
1726 1726
     {
1727
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1727
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1728 1728
         {
1729 1729
             return $this;
1730 1730
         }
1731
-        if ( $this->value instanceof $className )
1731
+        if ($this->value instanceof $className)
1732 1732
         {
1733 1733
             $message = $message ?: $this->overrideError;
1734 1734
             $message = sprintf(
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
                 $this->stringify($this->value),
1737 1737
                 $className
1738 1738
             );
1739
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $propertyPath, ['class' => $className]);
1739
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $propertyPath, [ 'class' => $className ]);
1740 1740
         }
1741 1741
         return $this;
1742 1742
     }
@@ -1752,11 +1752,11 @@  discard block
 block discarded – undo
1752 1752
      */
1753 1753
     public function subclassOf($className, $message = null, $propertyPath = null)
1754 1754
     {
1755
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1755
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1756 1756
         {
1757 1757
             return $this;
1758 1758
         }
1759
-        if ( !is_subclass_of($this->value, $className) )
1759
+        if ( ! is_subclass_of($this->value, $className))
1760 1760
         {
1761 1761
             $message = $message ?: $this->overrideError;
1762 1762
             $message = sprintf(
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
                 $this->stringify($this->value),
1765 1765
                 $className
1766 1766
             );
1767
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $propertyPath, ['class' => $className]);
1767
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $propertyPath, [ 'class' => $className ]);
1768 1768
         }
1769 1769
         return $this;
1770 1770
     }
@@ -1781,12 +1781,12 @@  discard block
 block discarded – undo
1781 1781
      */
1782 1782
     public function range($minValue, $maxValue, $message = null, $propertyPath = null)
1783 1783
     {
1784
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1784
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1785 1785
         {
1786 1786
             return $this;
1787 1787
         }
1788 1788
         $this->numeric($message, $propertyPath);
1789
-        if ( $this->value < $minValue || $this->value > $maxValue )
1789
+        if ($this->value < $minValue || $this->value > $maxValue)
1790 1790
         {
1791 1791
             $message = $message ?: $this->overrideError;
1792 1792
             $message = sprintf(
@@ -1814,12 +1814,12 @@  discard block
 block discarded – undo
1814 1814
      */
1815 1815
     public function min($minValue, $message = null, $propertyPath = null)
1816 1816
     {
1817
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1817
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1818 1818
         {
1819 1819
             return $this;
1820 1820
         }
1821 1821
         $this->numeric($message, $propertyPath);
1822
-        if ( $this->value < $minValue )
1822
+        if ($this->value < $minValue)
1823 1823
         {
1824 1824
             $message = $message ?: $this->overrideError;
1825 1825
             $message = sprintf(
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
                 $this->stringify($this->value),
1828 1828
                 $this->stringify($minValue)
1829 1829
             );
1830
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $propertyPath, ['min' => $minValue]);
1830
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $propertyPath, [ 'min' => $minValue ]);
1831 1831
         }
1832 1832
         return $this;
1833 1833
     }
@@ -1843,12 +1843,12 @@  discard block
 block discarded – undo
1843 1843
      */
1844 1844
     public function max($maxValue, $message = null, $propertyPath = null)
1845 1845
     {
1846
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1846
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1847 1847
         {
1848 1848
             return $this;
1849 1849
         }
1850 1850
         $this->numeric($message, $propertyPath);
1851
-        if ( $this->value > $maxValue )
1851
+        if ($this->value > $maxValue)
1852 1852
         {
1853 1853
             $message = $message ?: $this->overrideError;
1854 1854
             $message = sprintf(
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
                 $this->stringify($this->value),
1857 1857
                 $this->stringify($maxValue)
1858 1858
             );
1859
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $propertyPath, ['max' => $maxValue]);
1859
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $propertyPath, [ 'max' => $maxValue ]);
1860 1860
         }
1861 1861
         return $this;
1862 1862
     }
@@ -1871,13 +1871,13 @@  discard block
 block discarded – undo
1871 1871
      */
1872 1872
     public function file($message = null, $propertyPath = null)
1873 1873
     {
1874
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1874
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1875 1875
         {
1876 1876
             return $this;
1877 1877
         }
1878 1878
         $this->string($message, $propertyPath);
1879 1879
         $this->notEmpty($message, $propertyPath);
1880
-        if ( !is_file($this->value) )
1880
+        if ( ! is_file($this->value))
1881 1881
         {
1882 1882
             $message = $message ?: $this->overrideError;
1883 1883
             $message = sprintf(
@@ -1897,13 +1897,13 @@  discard block
 block discarded – undo
1897 1897
      */
1898 1898
     public function fileExists($message = null, $propertyPath = null)
1899 1899
     {
1900
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1900
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1901 1901
         {
1902 1902
             return $this;
1903 1903
         }
1904 1904
         $this->string($message, $propertyPath);
1905 1905
         $this->notEmpty($message, $propertyPath);
1906
-        if ( ! file_exists($this->value) )
1906
+        if ( ! file_exists($this->value))
1907 1907
         {
1908 1908
             $message = $message ?: $this->overrideError;
1909 1909
             $message = sprintf(
@@ -1925,12 +1925,12 @@  discard block
 block discarded – undo
1925 1925
      */
1926 1926
     public function directory($message = null, $propertyPath = null)
1927 1927
     {
1928
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1928
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1929 1929
         {
1930 1930
             return $this;
1931 1931
         }
1932 1932
         $this->string($message, $propertyPath);
1933
-        if ( !is_dir($this->value) )
1933
+        if ( ! is_dir($this->value))
1934 1934
         {
1935 1935
             $message = $message ?: $this->overrideError;
1936 1936
             $message = sprintf(
@@ -1952,12 +1952,12 @@  discard block
 block discarded – undo
1952 1952
      */
1953 1953
     public function readable($message = null, $propertyPath = null)
1954 1954
     {
1955
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1955
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1956 1956
         {
1957 1957
             return $this;
1958 1958
         }
1959 1959
         $this->string($message, $propertyPath);
1960
-        if ( !is_readable($this->value) )
1960
+        if ( ! is_readable($this->value))
1961 1961
         {
1962 1962
             $message = $message ?: $this->overrideError;
1963 1963
             $message = sprintf(
@@ -1979,12 +1979,12 @@  discard block
 block discarded – undo
1979 1979
      */
1980 1980
     public function writeable($message = null, $propertyPath = null)
1981 1981
     {
1982
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1982
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1983 1983
         {
1984 1984
             return $this;
1985 1985
         }
1986 1986
         $this->string($message, $propertyPath);
1987
-        if ( !is_writeable($this->value) )
1987
+        if ( ! is_writeable($this->value))
1988 1988
         {
1989 1989
             $message = $message ?: $this->overrideError;
1990 1990
             $message = sprintf(
@@ -2007,12 +2007,12 @@  discard block
 block discarded – undo
2007 2007
      */
2008 2008
     public function email($message = null, $propertyPath = null)
2009 2009
     {
2010
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2010
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2011 2011
         {
2012 2012
             return $this;
2013 2013
         }
2014 2014
         $this->string($message, $propertyPath);
2015
-        if ( ! filter_var($this->value, FILTER_VALIDATE_EMAIL) )
2015
+        if ( ! filter_var($this->value, FILTER_VALIDATE_EMAIL))
2016 2016
         {
2017 2017
             $message = $message ?: $this->overrideError;
2018 2018
             $message = sprintf(
@@ -2025,7 +2025,7 @@  discard block
 block discarded – undo
2025 2025
         {
2026 2026
             $host = substr($this->value, strpos($this->value, '@') + 1);
2027 2027
             // Likely not a FQDN, bug in PHP FILTER_VALIDATE_EMAIL prior to PHP 5.3.3
2028
-            if ( version_compare(PHP_VERSION, '5.3.3', '<') && strpos($host, '.') === false )
2028
+            if (version_compare(PHP_VERSION, '5.3.3', '<') && strpos($host, '.') === false)
2029 2029
             {
2030 2030
                 $message = $message ?: $this->overrideError;
2031 2031
                 $message = sprintf(
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
      */
2047 2047
     public function emailPrefix($message = null, $propertyPath = null)
2048 2048
     {
2049
-        $this->value($this->value . '@example.com');
2049
+        $this->value($this->value.'@example.com');
2050 2050
         return $this->email($message, $propertyPath);
2051 2051
     }
2052 2052
 
@@ -2066,12 +2066,12 @@  discard block
 block discarded – undo
2066 2066
      */
2067 2067
     public function url($message = null, $propertyPath = null)
2068 2068
     {
2069
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2069
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2070 2070
         {
2071 2071
             return $this;
2072 2072
         }
2073 2073
         $this->string($message, $propertyPath);
2074
-        $protocols = ['http', 'https'];
2074
+        $protocols = [ 'http', 'https' ];
2075 2075
         $pattern   = '~^
2076 2076
             (%s)://                                 # protocol
2077 2077
             (
@@ -2086,8 +2086,8 @@  discard block
 block discarded – undo
2086 2086
             (:[0-9]+)?                              # a port (optional)
2087 2087
             (/?|/\S+)                               # a /, nothing or a / with something
2088 2088
         $~ixu';
2089
-        $pattern   = sprintf($pattern, implode('|', $protocols));
2090
-        if ( !preg_match($pattern, $this->value) )
2089
+        $pattern = sprintf($pattern, implode('|', $protocols));
2090
+        if ( ! preg_match($pattern, $this->value))
2091 2091
         {
2092 2092
             $message = $message ?: $this->overrideError;
2093 2093
             $message = sprintf(
@@ -2112,13 +2112,13 @@  discard block
 block discarded – undo
2112 2112
      */
2113 2113
     public function domainName($message = null, $propertyPath = null)
2114 2114
     {
2115
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2115
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2116 2116
         {
2117 2117
             return $this;
2118 2118
         }
2119 2119
         $this->string($message, $propertyPath);
2120
-        $pattern   = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/';
2121
-        if ( ! preg_match($pattern, $this->value) )
2120
+        $pattern = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/';
2121
+        if ( ! preg_match($pattern, $this->value))
2122 2122
         {
2123 2123
             $message = $message ?: $this->overrideError;
2124 2124
             $message = sprintf(
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
      */
2141 2141
     public function ausMobile($message = null, $propertyPath = null)
2142 2142
     {
2143
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2143
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2144 2144
         {
2145 2145
             return $this;
2146 2146
         }
@@ -2148,7 +2148,7 @@  discard block
 block discarded – undo
2148 2148
         {
2149 2149
             $this->regex('/^04[0-9]{8})$/', $message, $propertyPath);
2150 2150
         }
2151
-        catch ( AssertionFailedException $e )
2151
+        catch (AssertionFailedException $e)
2152 2152
         {
2153 2153
             $message = $message ?: $this->overrideError;
2154 2154
             $message = sprintf(
@@ -2171,7 +2171,7 @@  discard block
 block discarded – undo
2171 2171
      */
2172 2172
     public function alnum($message = null, $propertyPath = null)
2173 2173
     {
2174
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2174
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2175 2175
         {
2176 2176
             return $this;
2177 2177
         }
@@ -2202,11 +2202,11 @@  discard block
 block discarded – undo
2202 2202
      */
2203 2203
     public function true($message = null, $propertyPath = null)
2204 2204
     {
2205
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2205
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2206 2206
         {
2207 2207
             return $this;
2208 2208
         }
2209
-        if ( $this->value !== true )
2209
+        if ($this->value !== true)
2210 2210
         {
2211 2211
             $message = $message ?: $this->overrideError;
2212 2212
             $message = sprintf(
@@ -2229,11 +2229,11 @@  discard block
 block discarded – undo
2229 2229
      */
2230 2230
     public function truthy($message = null, $propertyPath = null)
2231 2231
     {
2232
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2232
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2233 2233
         {
2234 2234
             return $this;
2235 2235
         }
2236
-        if ( ! $this->value )
2236
+        if ( ! $this->value)
2237 2237
         {
2238 2238
             $message = $message ?: $this->overrideError;
2239 2239
             $message = sprintf(
@@ -2255,11 +2255,11 @@  discard block
 block discarded – undo
2255 2255
      */
2256 2256
     public function false($message = null, $propertyPath = null)
2257 2257
     {
2258
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2258
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2259 2259
         {
2260 2260
             return $this;
2261 2261
         }
2262
-        if ( $this->value !== false )
2262
+        if ($this->value !== false)
2263 2263
         {
2264 2264
             $message = $message ?: $this->overrideError;
2265 2265
             $message = sprintf(
@@ -2281,11 +2281,11 @@  discard block
 block discarded – undo
2281 2281
      */
2282 2282
     public function notFalse($message = null, $propertyPath = null)
2283 2283
     {
2284
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2284
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2285 2285
         {
2286 2286
             return $this;
2287 2287
         }
2288
-        if ( $this->value === false )
2288
+        if ($this->value === false)
2289 2289
         {
2290 2290
             $message = $message ?: $this->overrideError;
2291 2291
             $message = sprintf(
@@ -2307,11 +2307,11 @@  discard block
 block discarded – undo
2307 2307
      */
2308 2308
     public function classExists($message = null, $propertyPath = null)
2309 2309
     {
2310
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2310
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2311 2311
         {
2312 2312
             return $this;
2313 2313
         }
2314
-        if ( !class_exists($this->value) )
2314
+        if ( ! class_exists($this->value))
2315 2315
         {
2316 2316
             $message = $message ?: $this->overrideError;
2317 2317
             $message = sprintf(
@@ -2334,12 +2334,12 @@  discard block
 block discarded – undo
2334 2334
      */
2335 2335
     public function implementsInterface($interfaceName, $message = null, $propertyPath = null)
2336 2336
     {
2337
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2337
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2338 2338
         {
2339 2339
             return $this;
2340 2340
         }
2341 2341
         $reflection = new \ReflectionClass($this->value);
2342
-        if ( !$reflection->implementsInterface($interfaceName) )
2342
+        if ( ! $reflection->implementsInterface($interfaceName))
2343 2343
         {
2344 2344
             $message = $message ?: $this->overrideError;
2345 2345
             $message = sprintf(
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
                 $this->stringify($this->value),
2348 2348
                 $this->stringify($interfaceName)
2349 2349
             );
2350
-            throw $this->createException($message, self::INTERFACE_NOT_IMPLEMENTED, $propertyPath, ['interface' => $interfaceName]);
2350
+            throw $this->createException($message, self::INTERFACE_NOT_IMPLEMENTED, $propertyPath, [ 'interface' => $interfaceName ]);
2351 2351
         }
2352 2352
         return $this;
2353 2353
     }
@@ -2368,11 +2368,11 @@  discard block
 block discarded – undo
2368 2368
      */
2369 2369
     public function isJsonString($message = null, $propertyPath = null)
2370 2370
     {
2371
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2371
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2372 2372
         {
2373 2373
             return $this;
2374 2374
         }
2375
-        if ( null === json_decode($this->value) && JSON_ERROR_NONE !== json_last_error() )
2375
+        if (null === json_decode($this->value) && JSON_ERROR_NONE !== json_last_error())
2376 2376
         {
2377 2377
             $message = $message ?: $this->overrideError;
2378 2378
             $message = sprintf(
@@ -2396,16 +2396,16 @@  discard block
 block discarded – undo
2396 2396
      */
2397 2397
     public function uuid($message = null, $propertyPath = null)
2398 2398
     {
2399
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2399
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2400 2400
         {
2401 2401
             return $this;
2402 2402
         }
2403
-        $this->value = str_replace(['urn:', 'uuid:', '{', '}'], '', $this->value);
2404
-        if ( $this->value === '00000000-0000-0000-0000-000000000000' )
2403
+        $this->value = str_replace([ 'urn:', 'uuid:', '{', '}' ], '', $this->value);
2404
+        if ($this->value === '00000000-0000-0000-0000-000000000000')
2405 2405
         {
2406 2406
             return $this;
2407 2407
         }
2408
-        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) )
2408
+        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))
2409 2409
         {
2410 2410
             $message = $message ?: $this->overrideError;
2411 2411
             $message = sprintf(
@@ -2431,11 +2431,11 @@  discard block
 block discarded – undo
2431 2431
      */
2432 2432
     public function samAccountName($message = null, $propertyPath = null)
2433 2433
     {
2434
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2434
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2435 2435
         {
2436 2436
             return $this;
2437 2437
         }
2438
-        if ( !preg_match('/^([a-z0-9]{4,20})$/', $this->value) )
2438
+        if ( ! preg_match('/^([a-z0-9]{4,20})$/', $this->value))
2439 2439
         {
2440 2440
             $message = $message ?: $this->overrideError;
2441 2441
             $message = sprintf(
@@ -2457,7 +2457,7 @@  discard block
 block discarded – undo
2457 2457
      */
2458 2458
     public function userPrincipalName($message = null, $propertyPath = null)
2459 2459
     {
2460
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2460
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2461 2461
         {
2462 2462
             return $this;
2463 2463
         }
@@ -2486,11 +2486,11 @@  discard block
 block discarded – undo
2486 2486
      */
2487 2487
     public function count($count, $message = null, $propertyPath = null)
2488 2488
     {
2489
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2489
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2490 2490
         {
2491 2491
             return $this;
2492 2492
         }
2493
-        if ( $count !== count($this->value) )
2493
+        if ($count !== count($this->value))
2494 2494
         {
2495 2495
             $message = $message ?: $this->overrideError;
2496 2496
             $message = sprintf(
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
                 $this->stringify($this->value),
2499 2499
                 $this->stringify($count)
2500 2500
             );
2501
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $propertyPath, ['count' => $count]);
2501
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $propertyPath, [ 'count' => $count ]);
2502 2502
         }
2503 2503
         return $this;
2504 2504
     }
@@ -2511,24 +2511,24 @@  discard block
 block discarded – undo
2511 2511
      */
2512 2512
     protected function doAllOrNullOr($func, $args)
2513 2513
     {
2514
-        if ( $this->nullOr && is_null($this->value) )
2514
+        if ($this->nullOr && is_null($this->value))
2515 2515
         {
2516 2516
             return true;
2517 2517
         }
2518
-        if ( $this->emptyOr && empty($this->value) )
2518
+        if ($this->emptyOr && empty($this->value))
2519 2519
         {
2520 2520
             return true;
2521 2521
         }
2522
-        if ( $this->all && (new Assert($this->value))->setExceptionClass($this->exceptionClass)->isTraversable() )
2522
+        if ($this->all && (new Assert($this->value))->setExceptionClass($this->exceptionClass)->isTraversable())
2523 2523
         {
2524
-            foreach ( $this->value as $idx => $value )
2524
+            foreach ($this->value as $idx => $value)
2525 2525
             {
2526 2526
                 $object = (new Assert($value))->setExceptionClass($this->exceptionClass);
2527
-                call_user_func_array([$object, $func], $args);
2527
+                call_user_func_array([ $object, $func ], $args);
2528 2528
             }
2529 2529
             return true;
2530 2530
         }
2531
-        return ( $this->nullOr && is_null($this->value) ) || ( $this->emptyOr && empty($this->value) ) ? true : false;
2531
+        return ($this->nullOr && is_null($this->value)) || ($this->emptyOr && empty($this->value)) ? true : false;
2532 2532
     }
2533 2533
 
2534 2534
     /**
@@ -2541,12 +2541,12 @@  discard block
 block discarded – undo
2541 2541
      */
2542 2542
     public function choicesNotEmpty(array $choices, $message = null, $propertyPath = null)
2543 2543
     {
2544
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2544
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2545 2545
         {
2546 2546
             return $this;
2547 2547
         }
2548 2548
         $this->notEmpty($message, $propertyPath);
2549
-        foreach ( $choices as $choice )
2549
+        foreach ($choices as $choice)
2550 2550
         {
2551 2551
             $this->notEmptyKey($choice, $message, $propertyPath);
2552 2552
         }
@@ -2564,12 +2564,12 @@  discard block
 block discarded – undo
2564 2564
      */
2565 2565
     public function methodExists($object, $message = null, $propertyPath = null)
2566 2566
     {
2567
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2567
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2568 2568
         {
2569 2569
             return $this;
2570 2570
         }
2571 2571
         (new Assert($object))->setExceptionClass($this->exceptionClass)->isObject($message, $propertyPath);
2572
-        if ( !method_exists($object, $this->value) )
2572
+        if ( ! method_exists($object, $this->value))
2573 2573
         {
2574 2574
             $message = $message ?: $this->overrideError;
2575 2575
             $message = sprintf(
@@ -2591,11 +2591,11 @@  discard block
 block discarded – undo
2591 2591
      */
2592 2592
     public function isObject($message = null, $propertyPath = null)
2593 2593
     {
2594
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2594
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2595 2595
         {
2596 2596
             return $this;
2597 2597
         }
2598
-        if ( !is_object($this->value) )
2598
+        if ( ! is_object($this->value))
2599 2599
         {
2600 2600
             $message = $message ?: $this->overrideError;
2601 2601
             $message = sprintf(
@@ -2615,32 +2615,32 @@  discard block
 block discarded – undo
2615 2615
      */
2616 2616
     private function stringify($value)
2617 2617
     {
2618
-        if ( is_bool($value) )
2618
+        if (is_bool($value))
2619 2619
         {
2620 2620
             return $value ? '<TRUE>' : '<FALSE>';
2621 2621
         }
2622
-        if ( is_scalar($value) )
2622
+        if (is_scalar($value))
2623 2623
         {
2624 2624
             $val = (string)$value;
2625
-            if ( strlen($val) > 100 )
2625
+            if (strlen($val) > 100)
2626 2626
             {
2627
-                $val = substr($val, 0, 97) . '...';
2627
+                $val = substr($val, 0, 97).'...';
2628 2628
             }
2629 2629
             return $val;
2630 2630
         }
2631
-        if ( is_array($value) )
2631
+        if (is_array($value))
2632 2632
         {
2633 2633
             return '<ARRAY>';
2634 2634
         }
2635
-        if ( is_object($value) )
2635
+        if (is_object($value))
2636 2636
         {
2637 2637
             return get_class($value);
2638 2638
         }
2639
-        if ( is_resource($value) )
2639
+        if (is_resource($value))
2640 2640
         {
2641 2641
             return '<RESOURCE>';
2642 2642
         }
2643
-        if ( $value === null )
2643
+        if ($value === null)
2644 2644
         {
2645 2645
             return '<NULL>';
2646 2646
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -154,8 +154,7 @@  discard block
 block discarded – undo
154 154
             try
155 155
             {
156 156
                 $validator->__invoke();
157
-            }
158
-            catch ( AssertionFailedException $e )
157
+            } catch ( AssertionFailedException $e )
159 158
             {
160 159
                 $errors[$fieldName]     = $e->getMessage();
161 160
             }
@@ -2020,8 +2019,7 @@  discard block
 block discarded – undo
2020 2019
                 $this->stringify($this->value)
2021 2020
             );
2022 2021
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_EMAIL, $propertyPath);
2023
-        }
2024
-        else
2022
+        } else
2025 2023
         {
2026 2024
             $host = substr($this->value, strpos($this->value, '@') + 1);
2027 2025
             // Likely not a FQDN, bug in PHP FILTER_VALIDATE_EMAIL prior to PHP 5.3.3
@@ -2147,8 +2145,7 @@  discard block
 block discarded – undo
2147 2145
         try
2148 2146
         {
2149 2147
             $this->regex('/^04[0-9]{8})$/', $message, $propertyPath);
2150
-        }
2151
-        catch ( AssertionFailedException $e )
2148
+        } catch ( AssertionFailedException $e )
2152 2149
         {
2153 2150
             $message = $message ?: $this->overrideError;
2154 2151
             $message = sprintf(
@@ -2178,8 +2175,7 @@  discard block
 block discarded – undo
2178 2175
         try
2179 2176
         {
2180 2177
             $this->regex('(^([a-zA-Z]{1}[a-zA-Z0-9]*)$)', $message, $propertyPath);
2181
-        }
2182
-        catch (AssertionFailedException $e)
2178
+        } catch (AssertionFailedException $e)
2183 2179
         {
2184 2180
             $message = $message ?: $this->overrideError;
2185 2181
             $message = sprintf(
Please login to merge, or discard this patch.