| @@ -1,4 +1,4 @@ discard block | ||
| 1 | -<?php declare(strict_types=1); | |
| 1 | +<?php declare(strict_types = 1); | |
| 2 | 2 | |
| 3 | 3 | namespace Terah\Assert; | 
| 4 | 4 | |
| @@ -134,7 +134,7 @@ discard block | ||
| 134 | 134 | * | 
| 135 | 135 | * @var string | 
| 136 | 136 | */ | 
| 137 | - protected $exceptionClass = 'Terah\Assert\AssertionFailedException'; | |
| 137 | + protected $exceptionClass = 'Terah\Assert\AssertionFailedException'; | |
| 138 | 138 | |
| 139 | 139 | /** | 
| 140 | 140 | * @param mixed $value | 
| @@ -151,16 +151,16 @@ discard block | ||
| 151 | 151 | */ | 
| 152 | 152 | public static function runValidators(array $validators) : array | 
| 153 | 153 |      { | 
| 154 | - $errors = []; | |
| 155 | - foreach ( $validators as $fieldName => $validator ) | |
| 154 | + $errors = [ ]; | |
| 155 | + foreach ($validators as $fieldName => $validator) | |
| 156 | 156 |          { | 
| 157 | 157 | try | 
| 158 | 158 |              { | 
| 159 | 159 | $validator->__invoke(); | 
| 160 | 160 | } | 
| 161 | - catch ( AssertionFailedException $e ) | |
| 161 | + catch (AssertionFailedException $e) | |
| 162 | 162 |              { | 
| 163 | - $errors[$fieldName] = $e->getMessage(); | |
| 163 | + $errors[ $fieldName ] = $e->getMessage(); | |
| 164 | 164 | } | 
| 165 | 165 | } | 
| 166 | 166 | |
| @@ -175,22 +175,22 @@ discard block | ||
| 175 | 175 | * @param string $level | 
| 176 | 176 | * @return Assert | 
| 177 | 177 | */ | 
| 178 | - public static function that($value, $fieldName='', $code=0, $error='', $level=Assert::WARNING) | |
| 178 | + public static function that($value, $fieldName = '', $code = 0, $error = '', $level = Assert::WARNING) | |
| 179 | 179 |      { | 
| 180 | 180 | $assert = new static($value); | 
| 181 | - if ( $fieldName ) | |
| 181 | + if ($fieldName) | |
| 182 | 182 |          { | 
| 183 | 183 | $assert->fieldName($fieldName); | 
| 184 | 184 | } | 
| 185 | - if ( $code ) | |
| 185 | + if ($code) | |
| 186 | 186 |          { | 
| 187 | 187 | $assert->code($code); | 
| 188 | 188 | } | 
| 189 | - if ( $error ) | |
| 189 | + if ($error) | |
| 190 | 190 |          { | 
| 191 | 191 | $assert->error($error); | 
| 192 | 192 | } | 
| 193 | - if ( $level ) | |
| 193 | + if ($level) | |
| 194 | 194 |          { | 
| 195 | 195 | $assert->level($level); | 
| 196 | 196 | } | 
| @@ -265,7 +265,7 @@ discard block | ||
| 265 | 265 | * @param string $level | 
| 266 | 266 | * @return AssertionFailedException | 
| 267 | 267 | */ | 
| 268 | - protected function createException($message, $code, $fieldName, array $constraints = [], $level=null) | |
| 268 | + protected function createException($message, $code, $fieldName, array $constraints = [ ], $level = null) | |
| 269 | 269 |      { | 
| 270 | 270 | $exceptionClass = $this->exceptionClass; | 
| 271 | 271 | $fieldName = is_null($fieldName) ? $this->fieldName : $fieldName; | 
| @@ -351,11 +351,11 @@ discard block | ||
| 351 | 351 | */ | 
| 352 | 352 | public function eq($value2, $message = null, $fieldName = null) | 
| 353 | 353 |      { | 
| 354 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 354 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 355 | 355 |          { | 
| 356 | 356 | return $this; | 
| 357 | 357 | } | 
| 358 | - if ( $this->value != $value2 ) | |
| 358 | + if ($this->value != $value2) | |
| 359 | 359 |          { | 
| 360 | 360 | $message = $message ?: $this->overrideError; | 
| 361 | 361 | $message = sprintf( | 
| @@ -363,7 +363,7 @@ discard block | ||
| 363 | 363 | $this->stringify($this->value), | 
| 364 | 364 | $this->stringify($value2) | 
| 365 | 365 | ); | 
| 366 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, ['expected' => $value2]); | |
| 366 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, [ 'expected' => $value2 ]); | |
| 367 | 367 | } | 
| 368 | 368 | return $this; | 
| 369 | 369 | } | 
| @@ -379,11 +379,11 @@ discard block | ||
| 379 | 379 | */ | 
| 380 | 380 | public function greaterThan($value2, $message = null, $fieldName = null) | 
| 381 | 381 |      { | 
| 382 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 382 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 383 | 383 |          { | 
| 384 | 384 | return $this; | 
| 385 | 385 | } | 
| 386 | - if ( ! ( $this->value > $value2 ) ) | |
| 386 | + if ( ! ($this->value > $value2)) | |
| 387 | 387 |          { | 
| 388 | 388 | $message = $message ?: $this->overrideError; | 
| 389 | 389 | $message = sprintf( | 
| @@ -391,7 +391,7 @@ discard block | ||
| 391 | 391 | $this->stringify($this->value), | 
| 392 | 392 | $this->stringify($value2) | 
| 393 | 393 | ); | 
| 394 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, ['expected' => $value2]); | |
| 394 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, [ 'expected' => $value2 ]); | |
| 395 | 395 | } | 
| 396 | 396 | return $this; | 
| 397 | 397 | } | 
| @@ -407,11 +407,11 @@ discard block | ||
| 407 | 407 | */ | 
| 408 | 408 | public function greaterThanOrEq($value2, $message = null, $fieldName = 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 | ||
| 419 | 419 | $this->stringify($this->value), | 
| 420 | 420 | $this->stringify($value2) | 
| 421 | 421 | ); | 
| 422 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, ['expected' => $value2]); | |
| 422 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, [ 'expected' => $value2 ]); | |
| 423 | 423 | } | 
| 424 | 424 | return $this; | 
| 425 | 425 | } | 
| @@ -435,11 +435,11 @@ discard block | ||
| 435 | 435 | */ | 
| 436 | 436 | public function lessThan($value2, $message = null, $fieldName = null) | 
| 437 | 437 |      { | 
| 438 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 438 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 439 | 439 |          { | 
| 440 | 440 | return $this; | 
| 441 | 441 | } | 
| 442 | - if ( ! ( $this->value < $value2 ) ) | |
| 442 | + if ( ! ($this->value < $value2)) | |
| 443 | 443 |          { | 
| 444 | 444 | $message = $message ?: $this->overrideError; | 
| 445 | 445 | $message = sprintf( | 
| @@ -447,7 +447,7 @@ discard block | ||
| 447 | 447 | $this->stringify($this->value), | 
| 448 | 448 | $this->stringify($value2) | 
| 449 | 449 | ); | 
| 450 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $fieldName, ['expected' => $value2]); | |
| 450 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $fieldName, [ 'expected' => $value2 ]); | |
| 451 | 451 | } | 
| 452 | 452 | return $this; | 
| 453 | 453 | } | 
| @@ -463,11 +463,11 @@ discard block | ||
| 463 | 463 | */ | 
| 464 | 464 | public function lessThanOrEq($value2, $message = null, $fieldName = null) | 
| 465 | 465 |      { | 
| 466 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 466 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 467 | 467 |          { | 
| 468 | 468 | return $this; | 
| 469 | 469 | } | 
| 470 | - if ( ! ( $this->value <= $value2 ) ) | |
| 470 | + if ( ! ($this->value <= $value2)) | |
| 471 | 471 |          { | 
| 472 | 472 | $message = $message ?: $this->overrideError; | 
| 473 | 473 | $message = sprintf( | 
| @@ -475,7 +475,7 @@ discard block | ||
| 475 | 475 | $this->stringify($this->value), | 
| 476 | 476 | $this->stringify($value2) | 
| 477 | 477 | ); | 
| 478 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $fieldName, ['expected' => $value2]); | |
| 478 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $fieldName, [ 'expected' => $value2 ]); | |
| 479 | 479 | } | 
| 480 | 480 | return $this; | 
| 481 | 481 | } | 
| @@ -491,11 +491,11 @@ discard block | ||
| 491 | 491 | */ | 
| 492 | 492 | public function same($value2, $message = null, $fieldName = null) | 
| 493 | 493 |      { | 
| 494 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 494 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 495 | 495 |          { | 
| 496 | 496 | return $this; | 
| 497 | 497 | } | 
| 498 | - if ( $this->value !== $value2 ) | |
| 498 | + if ($this->value !== $value2) | |
| 499 | 499 |          { | 
| 500 | 500 | $message = $message ?: $this->overrideError; | 
| 501 | 501 | $message = sprintf( | 
| @@ -503,7 +503,7 @@ discard block | ||
| 503 | 503 | $this->stringify($this->value), | 
| 504 | 504 | $this->stringify($value2) | 
| 505 | 505 | ); | 
| 506 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $fieldName, ['expected' => $value2]); | |
| 506 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $fieldName, [ 'expected' => $value2 ]); | |
| 507 | 507 | } | 
| 508 | 508 | return $this; | 
| 509 | 509 | } | 
| @@ -519,11 +519,11 @@ discard block | ||
| 519 | 519 | */ | 
| 520 | 520 | public function notEq($value2, $message = null, $fieldName = null) | 
| 521 | 521 |      { | 
| 522 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 522 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 523 | 523 |          { | 
| 524 | 524 | return $this; | 
| 525 | 525 | } | 
| 526 | - if ( $this->value == $value2 ) | |
| 526 | + if ($this->value == $value2) | |
| 527 | 527 |          { | 
| 528 | 528 | $message = $message ?: $this->overrideError; | 
| 529 | 529 | $message = sprintf( | 
| @@ -531,7 +531,7 @@ discard block | ||
| 531 | 531 | $this->stringify($this->value), | 
| 532 | 532 | $this->stringify($value2) | 
| 533 | 533 | ); | 
| 534 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $fieldName, ['expected' => $value2]); | |
| 534 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $fieldName, [ 'expected' => $value2 ]); | |
| 535 | 535 | } | 
| 536 | 536 | return $this; | 
| 537 | 537 | } | 
| @@ -546,11 +546,11 @@ discard block | ||
| 546 | 546 | */ | 
| 547 | 547 | public function isCallable($message = null, $fieldName = null) | 
| 548 | 548 |      { | 
| 549 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 549 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 550 | 550 |          { | 
| 551 | 551 | return $this; | 
| 552 | 552 | } | 
| 553 | - if ( !is_callable($this->value) ) | |
| 553 | + if ( ! is_callable($this->value)) | |
| 554 | 554 |          { | 
| 555 | 555 | $message = $message ?: $this->overrideError; | 
| 556 | 556 | $message = sprintf( | 
| @@ -573,11 +573,11 @@ discard block | ||
| 573 | 573 | */ | 
| 574 | 574 | public function notSame($value2, $message = null, $fieldName = null) | 
| 575 | 575 |      { | 
| 576 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 576 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 577 | 577 |          { | 
| 578 | 578 | return $this; | 
| 579 | 579 | } | 
| 580 | - if ( $this->value === $value2 ) | |
| 580 | + if ($this->value === $value2) | |
| 581 | 581 |          { | 
| 582 | 582 | $message = $message ?: $this->overrideError; | 
| 583 | 583 | $message = sprintf( | 
| @@ -585,7 +585,7 @@ discard block | ||
| 585 | 585 | $this->stringify($this->value), | 
| 586 | 586 | $this->stringify($value2) | 
| 587 | 587 | ); | 
| 588 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $fieldName, ['expected' => $value2]); | |
| 588 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $fieldName, [ 'expected' => $value2 ]); | |
| 589 | 589 | } | 
| 590 | 590 | return $this; | 
| 591 | 591 | } | 
| @@ -612,7 +612,7 @@ discard block | ||
| 612 | 612 | * @return Assert | 
| 613 | 613 | * @throws AssertionFailedException | 
| 614 | 614 | */ | 
| 615 | - public function unsignedInt($message=null, $fieldName=null) | |
| 615 | + public function unsignedInt($message = null, $fieldName = null) | |
| 616 | 616 |      { | 
| 617 | 617 | $message = $message ?: $this->overrideError; | 
| 618 | 618 | $message = $message ?: 'Value "%s" is not an integer id.'; | 
| @@ -647,7 +647,7 @@ discard block | ||
| 647 | 647 |      { | 
| 648 | 648 | $message = $message ?: $this->overrideError; | 
| 649 | 649 | $message = $message ?: 'Value "%s" is not a valid status.'; | 
| 650 | - return $this->integer($message, $fieldName)->inArray([-1, 0, 1]); | |
| 650 | + return $this->integer($message, $fieldName)->inArray([-1, 0, 1 ]); | |
| 651 | 651 | } | 
| 652 | 652 | |
| 653 | 653 | /** | 
| @@ -699,11 +699,11 @@ discard block | ||
| 699 | 699 | */ | 
| 700 | 700 | public function integer($message = null, $fieldName = null) | 
| 701 | 701 |      { | 
| 702 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 702 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 703 | 703 |          { | 
| 704 | 704 | return $this; | 
| 705 | 705 | } | 
| 706 | - if ( !is_int($this->value) ) | |
| 706 | + if ( ! is_int($this->value)) | |
| 707 | 707 |          { | 
| 708 | 708 | $message = $message ?: $this->overrideError; | 
| 709 | 709 | $message = sprintf( | 
| @@ -725,11 +725,11 @@ discard block | ||
| 725 | 725 | */ | 
| 726 | 726 | public function float($message = null, $fieldName = null) | 
| 727 | 727 |      { | 
| 728 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 728 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 729 | 729 |          { | 
| 730 | 730 | return $this; | 
| 731 | 731 | } | 
| 732 | - if ( ! is_float($this->value) ) | |
| 732 | + if ( ! is_float($this->value)) | |
| 733 | 733 |          { | 
| 734 | 734 | $message = $message ?: $this->overrideError; | 
| 735 | 735 | $message = sprintf( | 
| @@ -751,11 +751,11 @@ discard block | ||
| 751 | 751 | */ | 
| 752 | 752 | public function digit($message = null, $fieldName = null) | 
| 753 | 753 |      { | 
| 754 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 754 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 755 | 755 |          { | 
| 756 | 756 | return $this; | 
| 757 | 757 | } | 
| 758 | - if ( ! ctype_digit((string)$this->value) ) | |
| 758 | + if ( ! ctype_digit((string)$this->value)) | |
| 759 | 759 |          { | 
| 760 | 760 | $message = $message ?: $this->overrideError; | 
| 761 | 761 | $message = sprintf( | 
| @@ -777,12 +777,12 @@ discard block | ||
| 777 | 777 | */ | 
| 778 | 778 | public function date($message = null, $fieldName = null) | 
| 779 | 779 |      { | 
| 780 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 780 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 781 | 781 |          { | 
| 782 | 782 | return $this; | 
| 783 | 783 | } | 
| 784 | 784 | $this->notEmpty($message, $fieldName); | 
| 785 | - if ( strtotime($this->value) === false ) | |
| 785 | + if (strtotime($this->value) === false) | |
| 786 | 786 |          { | 
| 787 | 787 | $message = $message ?: $this->overrideError; | 
| 788 | 788 | $message = sprintf( | 
| @@ -804,11 +804,11 @@ discard block | ||
| 804 | 804 | */ | 
| 805 | 805 | public function integerish($message = null, $fieldName = null) | 
| 806 | 806 |      { | 
| 807 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 807 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 808 | 808 |          { | 
| 809 | 809 | return $this; | 
| 810 | 810 | } | 
| 811 | - if ( is_object($this->value) || strval(intval($this->value)) != $this->value || is_bool($this->value) || is_null($this->value) ) | |
| 811 | + if (is_object($this->value) || strval(intval($this->value)) != $this->value || is_bool($this->value) || is_null($this->value)) | |
| 812 | 812 |          { | 
| 813 | 813 | $message = $message ?: $this->overrideError; | 
| 814 | 814 | $message = sprintf( | 
| @@ -830,11 +830,11 @@ discard block | ||
| 830 | 830 | */ | 
| 831 | 831 | public function boolean($message = null, $fieldName = null) | 
| 832 | 832 |      { | 
| 833 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 833 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 834 | 834 |          { | 
| 835 | 835 | return $this; | 
| 836 | 836 | } | 
| 837 | - if ( ! is_bool($this->value) ) | |
| 837 | + if ( ! is_bool($this->value)) | |
| 838 | 838 |          { | 
| 839 | 839 | $message = $message ?: $this->overrideError; | 
| 840 | 840 | $message = sprintf( | 
| @@ -856,11 +856,11 @@ discard block | ||
| 856 | 856 | */ | 
| 857 | 857 | public function scalar($message = null, $fieldName = null) | 
| 858 | 858 |      { | 
| 859 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 859 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 860 | 860 |          { | 
| 861 | 861 | return $this; | 
| 862 | 862 | } | 
| 863 | - if ( ! is_scalar($this->value) ) | |
| 863 | + if ( ! is_scalar($this->value)) | |
| 864 | 864 |          { | 
| 865 | 865 | $message = $message ?: $this->overrideError; | 
| 866 | 866 | $message = sprintf( | 
| @@ -882,11 +882,11 @@ discard block | ||
| 882 | 882 | */ | 
| 883 | 883 | public function notEmpty($message = null, $fieldName = null) | 
| 884 | 884 |      { | 
| 885 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 885 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 886 | 886 |          { | 
| 887 | 887 | return $this; | 
| 888 | 888 | } | 
| 889 | - if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) ) | |
| 889 | + if ((is_object($this->value) && empty((array)$this->value)) || empty($this->value)) | |
| 890 | 890 |          { | 
| 891 | 891 | $message = $message ?: $this->overrideError; | 
| 892 | 892 | $message = sprintf( | 
| @@ -908,11 +908,11 @@ discard block | ||
| 908 | 908 | */ | 
| 909 | 909 | public function noContent($message = null, $fieldName = null) | 
| 910 | 910 |      { | 
| 911 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 911 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 912 | 912 |          { | 
| 913 | 913 | return $this; | 
| 914 | 914 | } | 
| 915 | - if ( !empty( $this->value ) ) | |
| 915 | + if ( ! empty($this->value)) | |
| 916 | 916 |          { | 
| 917 | 917 | $message = $message ?: $this->overrideError; | 
| 918 | 918 | $message = sprintf( | 
| @@ -934,11 +934,11 @@ discard block | ||
| 934 | 934 | */ | 
| 935 | 935 | public function notNull($message = null, $fieldName = null) | 
| 936 | 936 |      { | 
| 937 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 937 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 938 | 938 |          { | 
| 939 | 939 | return $this; | 
| 940 | 940 | } | 
| 941 | - if ( $this->value === null ) | |
| 941 | + if ($this->value === null) | |
| 942 | 942 |          { | 
| 943 | 943 | $message = $message ?: $this->overrideError; | 
| 944 | 944 | $message = sprintf( | 
| @@ -960,11 +960,11 @@ discard block | ||
| 960 | 960 | */ | 
| 961 | 961 | public function string($message = null, $fieldName = null) | 
| 962 | 962 |      { | 
| 963 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 963 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 964 | 964 |          { | 
| 965 | 965 | return $this; | 
| 966 | 966 | } | 
| 967 | - if ( !is_string($this->value) ) | |
| 967 | + if ( ! is_string($this->value)) | |
| 968 | 968 |          { | 
| 969 | 969 | $message = $message ?: $this->overrideError; | 
| 970 | 970 | $message = sprintf( | 
| @@ -986,21 +986,21 @@ discard block | ||
| 986 | 986 | * @return Assert | 
| 987 | 987 | * @throws AssertionFailedException | 
| 988 | 988 | */ | 
| 989 | - public function regex($pattern, $message=null, $fieldName=null) | |
| 989 | + public function regex($pattern, $message = null, $fieldName = null) | |
| 990 | 990 |      { | 
| 991 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 991 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 992 | 992 |          { | 
| 993 | 993 | return $this; | 
| 994 | 994 | } | 
| 995 | 995 | $this->string($message, $fieldName); | 
| 996 | - if ( ! preg_match($pattern, $this->value) ) | |
| 996 | + if ( ! preg_match($pattern, $this->value)) | |
| 997 | 997 |          { | 
| 998 | 998 | $message = $message ?: $this->overrideError; | 
| 999 | 999 | $message = sprintf( | 
| 1000 | 1000 | $message ?: 'Value "%s" does not match expression.', | 
| 1001 | 1001 | $this->stringify($this->value) | 
| 1002 | 1002 | ); | 
| 1003 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $fieldName, ['pattern' => $pattern]); | |
| 1003 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $fieldName, [ 'pattern' => $pattern ]); | |
| 1004 | 1004 | } | 
| 1005 | 1005 | return $this; | 
| 1006 | 1006 | } | 
| @@ -1015,13 +1015,13 @@ discard block | ||
| 1015 | 1015 | */ | 
| 1016 | 1016 | public function ipAddress($message = null, $fieldName = null) | 
| 1017 | 1017 |      { | 
| 1018 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1018 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1019 | 1019 |          { | 
| 1020 | 1020 | return $this; | 
| 1021 | 1021 | } | 
| 1022 | 1022 | $this->string($message, $fieldName); | 
| 1023 | -        $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])$/'; | |
| 1024 | - if ( ! preg_match($pattern, $this->value) ) | |
| 1023 | +        $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])$/'; | |
| 1024 | + if ( ! preg_match($pattern, $this->value)) | |
| 1025 | 1025 |          { | 
| 1026 | 1026 | $message = $message ?: $this->overrideError; | 
| 1027 | 1027 | $message = sprintf( | 
| @@ -1044,19 +1044,19 @@ discard block | ||
| 1044 | 1044 | */ | 
| 1045 | 1045 | public function notRegex($pattern, $message = null, $fieldName = null) | 
| 1046 | 1046 |      { | 
| 1047 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1047 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1048 | 1048 |          { | 
| 1049 | 1049 | return $this; | 
| 1050 | 1050 | } | 
| 1051 | 1051 | $this->string($message, $fieldName); | 
| 1052 | - if ( preg_match($pattern, $this->value) ) | |
| 1052 | + if (preg_match($pattern, $this->value)) | |
| 1053 | 1053 |          { | 
| 1054 | 1054 | $message = $message ?: $this->overrideError; | 
| 1055 | 1055 | $message = sprintf( | 
| 1056 | 1056 | $message ?: 'Value "%s" does not match expression.', | 
| 1057 | 1057 | $this->stringify($this->value) | 
| 1058 | 1058 | ); | 
| 1059 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $fieldName, ['pattern' => $pattern]); | |
| 1059 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $fieldName, [ 'pattern' => $pattern ]); | |
| 1060 | 1060 | } | 
| 1061 | 1061 | return $this; | 
| 1062 | 1062 | } | 
| @@ -1073,12 +1073,12 @@ discard block | ||
| 1073 | 1073 | */ | 
| 1074 | 1074 | public function length($length, $message = null, $fieldName = null, $encoding = 'utf8') | 
| 1075 | 1075 |      { | 
| 1076 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1076 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1077 | 1077 |          { | 
| 1078 | 1078 | return $this; | 
| 1079 | 1079 | } | 
| 1080 | 1080 | $this->string($message, $fieldName); | 
| 1081 | - if ( mb_strlen($this->value, $encoding) !== $length ) | |
| 1081 | + if (mb_strlen($this->value, $encoding) !== $length) | |
| 1082 | 1082 |          { | 
| 1083 | 1083 | $message = $message ?: $this->overrideError; | 
| 1084 | 1084 | $message = sprintf( | 
| @@ -1087,7 +1087,7 @@ discard block | ||
| 1087 | 1087 | $length, | 
| 1088 | 1088 | mb_strlen($this->value, $encoding) | 
| 1089 | 1089 | ); | 
| 1090 | - $constraints = ['length' => $length, 'encoding' => $encoding]; | |
| 1090 | + $constraints = [ 'length' => $length, 'encoding' => $encoding ]; | |
| 1091 | 1091 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_LENGTH, $fieldName, $constraints); | 
| 1092 | 1092 | } | 
| 1093 | 1093 | return $this; | 
| @@ -1106,22 +1106,22 @@ discard block | ||
| 1106 | 1106 | */ | 
| 1107 | 1107 | public function minLength($minLength, $message = null, $fieldName = null, $encoding = 'utf8') | 
| 1108 | 1108 |      { | 
| 1109 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1109 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1110 | 1110 |          { | 
| 1111 | 1111 | return $this; | 
| 1112 | 1112 | } | 
| 1113 | 1113 | $this->string($message, $fieldName); | 
| 1114 | - if ( mb_strlen($this->value, $encoding) < $minLength ) | |
| 1114 | + if (mb_strlen($this->value, $encoding) < $minLength) | |
| 1115 | 1115 |          { | 
| 1116 | 1116 | $message = $message ?: $this->overrideError; | 
| 1117 | - $message = sprintf( | |
| 1117 | + $message = sprintf( | |
| 1118 | 1118 | $message | 
| 1119 | 1119 | ?: 'Value "%s" is too short, it should have more than %d characters, but only has %d characters.', | 
| 1120 | 1120 | $this->stringify($this->value), | 
| 1121 | 1121 | $minLength, | 
| 1122 | 1122 | mb_strlen($this->value, $encoding) | 
| 1123 | 1123 | ); | 
| 1124 | - $constraints = ['min_length' => $minLength, 'encoding' => $encoding]; | |
| 1124 | + $constraints = [ 'min_length' => $minLength, 'encoding' => $encoding ]; | |
| 1125 | 1125 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN_LENGTH, $fieldName, $constraints); | 
| 1126 | 1126 | } | 
| 1127 | 1127 | return $this; | 
| @@ -1140,21 +1140,21 @@ discard block | ||
| 1140 | 1140 | */ | 
| 1141 | 1141 | public function maxLength($maxLength, $message = null, $fieldName = null, $encoding = 'utf8') | 
| 1142 | 1142 |      { | 
| 1143 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1143 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1144 | 1144 |          { | 
| 1145 | 1145 | return $this; | 
| 1146 | 1146 | } | 
| 1147 | 1147 | $this->string($message, $fieldName); | 
| 1148 | - if ( mb_strlen($this->value, $encoding) > $maxLength ) | |
| 1148 | + if (mb_strlen($this->value, $encoding) > $maxLength) | |
| 1149 | 1149 |          { | 
| 1150 | 1150 | $message = $message ?: $this->overrideError; | 
| 1151 | - $message = sprintf( | |
| 1151 | + $message = sprintf( | |
| 1152 | 1152 | $message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.', | 
| 1153 | 1153 | $this->stringify($this->value), | 
| 1154 | 1154 | $maxLength, | 
| 1155 | 1155 | mb_strlen($this->value, $encoding) | 
| 1156 | 1156 | ); | 
| 1157 | - $constraints = ['max_length' => $maxLength, 'encoding' => $encoding]; | |
| 1157 | + $constraints = [ 'max_length' => $maxLength, 'encoding' => $encoding ]; | |
| 1158 | 1158 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX_LENGTH, $fieldName, $constraints); | 
| 1159 | 1159 | } | 
| 1160 | 1160 | return $this; | 
| @@ -1173,34 +1173,34 @@ discard block | ||
| 1173 | 1173 | */ | 
| 1174 | 1174 | public function betweenLength($minLength, $maxLength, $message = null, $fieldName = null, $encoding = 'utf8') | 
| 1175 | 1175 |      { | 
| 1176 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1176 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1177 | 1177 |          { | 
| 1178 | 1178 | return $this; | 
| 1179 | 1179 | } | 
| 1180 | 1180 | $this->string($message, $fieldName); | 
| 1181 | - if ( mb_strlen($this->value, $encoding) < $minLength ) | |
| 1181 | + if (mb_strlen($this->value, $encoding) < $minLength) | |
| 1182 | 1182 |          { | 
| 1183 | 1183 | $message = $message ?: $this->overrideError; | 
| 1184 | - $message = sprintf( | |
| 1184 | + $message = sprintf( | |
| 1185 | 1185 | $message | 
| 1186 | 1186 | ?: 'Value "%s" is too short, it should have more than %d characters, but only has %d characters.', | 
| 1187 | 1187 | $this->stringify($this->value), | 
| 1188 | 1188 | $minLength, | 
| 1189 | 1189 | mb_strlen($this->value, $encoding) | 
| 1190 | 1190 | ); | 
| 1191 | - $constraints = ['min_length' => $minLength, 'encoding' => $encoding]; | |
| 1191 | + $constraints = [ 'min_length' => $minLength, 'encoding' => $encoding ]; | |
| 1192 | 1192 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN_LENGTH, $fieldName, $constraints); | 
| 1193 | 1193 | } | 
| 1194 | - if ( mb_strlen($this->value, $encoding) > $maxLength ) | |
| 1194 | + if (mb_strlen($this->value, $encoding) > $maxLength) | |
| 1195 | 1195 |          { | 
| 1196 | 1196 | $message = $message ?: $this->overrideError; | 
| 1197 | - $message = sprintf( | |
| 1197 | + $message = sprintf( | |
| 1198 | 1198 | $message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.', | 
| 1199 | 1199 | $this->stringify($this->value), | 
| 1200 | 1200 | $maxLength, | 
| 1201 | 1201 | mb_strlen($this->value, $encoding) | 
| 1202 | 1202 | ); | 
| 1203 | - $constraints = ['max_length' => $maxLength, 'encoding' => $encoding]; | |
| 1203 | + $constraints = [ 'max_length' => $maxLength, 'encoding' => $encoding ]; | |
| 1204 | 1204 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX_LENGTH, $fieldName, $constraints); | 
| 1205 | 1205 | } | 
| 1206 | 1206 | return $this; | 
| @@ -1218,20 +1218,20 @@ discard block | ||
| 1218 | 1218 | */ | 
| 1219 | 1219 | public function startsWith($needle, $message = null, $fieldName = null, $encoding = 'utf8') | 
| 1220 | 1220 |      { | 
| 1221 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1221 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1222 | 1222 |          { | 
| 1223 | 1223 | return $this; | 
| 1224 | 1224 | } | 
| 1225 | 1225 | $this->string($message, $fieldName); | 
| 1226 | - if ( mb_strpos($this->value, $needle, 0, $encoding) !== 0 ) | |
| 1226 | + if (mb_strpos($this->value, $needle, 0, $encoding) !== 0) | |
| 1227 | 1227 |          { | 
| 1228 | 1228 | $message = $message ?: $this->overrideError; | 
| 1229 | - $message = sprintf( | |
| 1229 | + $message = sprintf( | |
| 1230 | 1230 | $message ?: 'Value "%s" does not start with "%s".', | 
| 1231 | 1231 | $this->stringify($this->value), | 
| 1232 | 1232 | $this->stringify($needle) | 
| 1233 | 1233 | ); | 
| 1234 | - $constraints = ['needle' => $needle, 'encoding' => $encoding]; | |
| 1234 | + $constraints = [ 'needle' => $needle, 'encoding' => $encoding ]; | |
| 1235 | 1235 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_START, $fieldName, $constraints); | 
| 1236 | 1236 | } | 
| 1237 | 1237 | return $this; | 
| @@ -1249,21 +1249,21 @@ discard block | ||
| 1249 | 1249 | */ | 
| 1250 | 1250 | public function endsWith($needle, $message = null, $fieldName = null, $encoding = 'utf8') | 
| 1251 | 1251 |      { | 
| 1252 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1252 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1253 | 1253 |          { | 
| 1254 | 1254 | return $this; | 
| 1255 | 1255 | } | 
| 1256 | 1256 | $this->string($message, $fieldName); | 
| 1257 | 1257 | $stringPosition = mb_strlen($this->value, $encoding) - mb_strlen($needle, $encoding); | 
| 1258 | - if ( mb_strripos($this->value, $needle, 0 , $encoding) !== $stringPosition ) | |
| 1258 | + if (mb_strripos($this->value, $needle, 0, $encoding) !== $stringPosition) | |
| 1259 | 1259 |          { | 
| 1260 | 1260 | $message = $message ?: $this->overrideError; | 
| 1261 | - $message = sprintf( | |
| 1261 | + $message = sprintf( | |
| 1262 | 1262 | $message ?: 'Value "%s" does not end with "%s".', | 
| 1263 | 1263 | $this->stringify($this->value), | 
| 1264 | 1264 | $this->stringify($needle) | 
| 1265 | 1265 | ); | 
| 1266 | - $constraints = ['needle' => $needle, 'encoding' => $encoding]; | |
| 1266 | + $constraints = [ 'needle' => $needle, 'encoding' => $encoding ]; | |
| 1267 | 1267 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_END, $fieldName, $constraints); | 
| 1268 | 1268 | } | 
| 1269 | 1269 | return $this; | 
| @@ -1281,20 +1281,20 @@ discard block | ||
| 1281 | 1281 | */ | 
| 1282 | 1282 | public function contains($needle, $message = null, $fieldName = null, $encoding = 'utf8') | 
| 1283 | 1283 |      { | 
| 1284 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1284 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1285 | 1285 |          { | 
| 1286 | 1286 | return $this; | 
| 1287 | 1287 | } | 
| 1288 | 1288 | $this->string($message, $fieldName); | 
| 1289 | - if ( mb_strpos($this->value, $needle, 0, $encoding) === false ) | |
| 1289 | + if (mb_strpos($this->value, $needle, 0, $encoding) === false) | |
| 1290 | 1290 |          { | 
| 1291 | 1291 | $message = $message ?: $this->overrideError; | 
| 1292 | - $message = sprintf( | |
| 1292 | + $message = sprintf( | |
| 1293 | 1293 | $message ?: 'Value "%s" does not contain "%s".', | 
| 1294 | 1294 | $this->stringify($this->value), | 
| 1295 | 1295 | $this->stringify($needle) | 
| 1296 | 1296 | ); | 
| 1297 | - $constraints = ['needle' => $needle, 'encoding' => $encoding]; | |
| 1297 | + $constraints = [ 'needle' => $needle, 'encoding' => $encoding ]; | |
| 1298 | 1298 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_CONTAINS, $fieldName, $constraints); | 
| 1299 | 1299 | } | 
| 1300 | 1300 | return $this; | 
| @@ -1311,11 +1311,11 @@ discard block | ||
| 1311 | 1311 | */ | 
| 1312 | 1312 | public function choice(array $choices, $message = null, $fieldName = null) | 
| 1313 | 1313 |      { | 
| 1314 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1314 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1315 | 1315 |          { | 
| 1316 | 1316 | return $this; | 
| 1317 | 1317 | } | 
| 1318 | - if ( !in_array($this->value, $choices, true) ) | |
| 1318 | + if ( ! in_array($this->value, $choices, true)) | |
| 1319 | 1319 |          { | 
| 1320 | 1320 | $message = $message ?: $this->overrideError; | 
| 1321 | 1321 | $message = sprintf( | 
| @@ -1323,7 +1323,7 @@ discard block | ||
| 1323 | 1323 | $this->stringify($this->value), | 
| 1324 | 1324 |                  implode(", ", array_map('Terah\Assert\Assert::stringify', $choices)) | 
| 1325 | 1325 | ); | 
| 1326 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_CHOICE, $fieldName, ['choices' => $choices]); | |
| 1326 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_CHOICE, $fieldName, [ 'choices' => $choices ]); | |
| 1327 | 1327 | } | 
| 1328 | 1328 | return $this; | 
| 1329 | 1329 | } | 
| @@ -1339,7 +1339,7 @@ discard block | ||
| 1339 | 1339 | */ | 
| 1340 | 1340 | public function inArray(array $choices, $message = null, $fieldName = null) | 
| 1341 | 1341 |      { | 
| 1342 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1342 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1343 | 1343 |          { | 
| 1344 | 1344 | return $this; | 
| 1345 | 1345 | } | 
| @@ -1357,11 +1357,11 @@ discard block | ||
| 1357 | 1357 | */ | 
| 1358 | 1358 | public function numeric($message = null, $fieldName = null) | 
| 1359 | 1359 |      { | 
| 1360 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1360 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1361 | 1361 |          { | 
| 1362 | 1362 | return $this; | 
| 1363 | 1363 | } | 
| 1364 | - if ( ! is_numeric($this->value) ) | |
| 1364 | + if ( ! is_numeric($this->value)) | |
| 1365 | 1365 |          { | 
| 1366 | 1366 | $message = $message ?: $this->overrideError; | 
| 1367 | 1367 | $message = sprintf( | 
| @@ -1425,11 +1425,11 @@ discard block | ||
| 1425 | 1425 | */ | 
| 1426 | 1426 | public function isArray($message = null, $fieldName = null) | 
| 1427 | 1427 |      { | 
| 1428 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1428 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1429 | 1429 |          { | 
| 1430 | 1430 | return $this; | 
| 1431 | 1431 | } | 
| 1432 | - if ( !is_array($this->value) ) | |
| 1432 | + if ( ! is_array($this->value)) | |
| 1433 | 1433 |          { | 
| 1434 | 1434 | $message = $message ?: $this->overrideError; | 
| 1435 | 1435 | $message = sprintf( | 
| @@ -1451,11 +1451,11 @@ discard block | ||
| 1451 | 1451 | */ | 
| 1452 | 1452 | public function isTraversable($message = null, $fieldName = null) | 
| 1453 | 1453 |      { | 
| 1454 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1454 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1455 | 1455 |          { | 
| 1456 | 1456 | return $this; | 
| 1457 | 1457 | } | 
| 1458 | - if ( !is_array($this->value) && !$this->value instanceof \Traversable ) | |
| 1458 | + if ( ! is_array($this->value) && ! $this->value instanceof \Traversable) | |
| 1459 | 1459 |          { | 
| 1460 | 1460 | $message = $message ?: $this->overrideError; | 
| 1461 | 1461 | $message = sprintf( | 
| @@ -1477,11 +1477,11 @@ discard block | ||
| 1477 | 1477 | */ | 
| 1478 | 1478 | public function isArrayAccessible($message = null, $fieldName = null) | 
| 1479 | 1479 |      { | 
| 1480 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1480 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1481 | 1481 |          { | 
| 1482 | 1482 | return $this; | 
| 1483 | 1483 | } | 
| 1484 | - if ( !is_array($this->value) && !$this->value instanceof \ArrayAccess ) | |
| 1484 | + if ( ! is_array($this->value) && ! $this->value instanceof \ArrayAccess) | |
| 1485 | 1485 |          { | 
| 1486 | 1486 | $message = $message ?: $this->overrideError; | 
| 1487 | 1487 | $message = sprintf( | 
| @@ -1504,19 +1504,19 @@ discard block | ||
| 1504 | 1504 | */ | 
| 1505 | 1505 | public function keyExists($key, $message = null, $fieldName = null) | 
| 1506 | 1506 |      { | 
| 1507 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1507 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1508 | 1508 |          { | 
| 1509 | 1509 | return $this; | 
| 1510 | 1510 | } | 
| 1511 | 1511 | $this->isArray($message, $fieldName); | 
| 1512 | - if ( !array_key_exists($key, $this->value) ) | |
| 1512 | + if ( ! array_key_exists($key, $this->value)) | |
| 1513 | 1513 |          { | 
| 1514 | 1514 | $message = $message ?: $this->overrideError; | 
| 1515 | 1515 | $message = sprintf( | 
| 1516 | 1516 | $message ?: 'Array does not contain an element with key "%s"', | 
| 1517 | 1517 | $this->stringify($key) | 
| 1518 | 1518 | ); | 
| 1519 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_EXISTS, $fieldName, ['key' => $key]); | |
| 1519 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_EXISTS, $fieldName, [ 'key' => $key ]); | |
| 1520 | 1520 | } | 
| 1521 | 1521 | return $this; | 
| 1522 | 1522 | } | 
| @@ -1532,21 +1532,21 @@ discard block | ||
| 1532 | 1532 | */ | 
| 1533 | 1533 | public function keysExist($keys, $message = null, $fieldName = null) | 
| 1534 | 1534 |      { | 
| 1535 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1535 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1536 | 1536 |          { | 
| 1537 | 1537 | return $this; | 
| 1538 | 1538 | } | 
| 1539 | 1539 | $this->isArray($message, $fieldName); | 
| 1540 | - foreach ( $keys as $key ) | |
| 1540 | + foreach ($keys as $key) | |
| 1541 | 1541 |          { | 
| 1542 | - if ( !array_key_exists($key, $this->value) ) | |
| 1542 | + if ( ! array_key_exists($key, $this->value)) | |
| 1543 | 1543 |              { | 
| 1544 | 1544 | $message = $message | 
| 1545 | 1545 | ?: sprintf( | 
| 1546 | 1546 | 'Array does not contain an element with key "%s"', | 
| 1547 | 1547 | $this->stringify($key) | 
| 1548 | 1548 | ); | 
| 1549 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEYS_EXIST, $fieldName, ['key' => $key]); | |
| 1549 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEYS_EXIST, $fieldName, [ 'key' => $key ]); | |
| 1550 | 1550 | } | 
| 1551 | 1551 | } | 
| 1552 | 1552 | return $this; | 
| @@ -1563,19 +1563,19 @@ discard block | ||
| 1563 | 1563 | */ | 
| 1564 | 1564 | public function propertyExists($key, $message = null, $fieldName = null) | 
| 1565 | 1565 |      { | 
| 1566 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1566 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1567 | 1567 |          { | 
| 1568 | 1568 | return $this; | 
| 1569 | 1569 | } | 
| 1570 | 1570 | $this->isObject($message, $fieldName); | 
| 1571 | -        if ( !property_exists($this->value, $key) && !isset( $this->value->{$key} ) ) | |
| 1571 | +        if ( ! property_exists($this->value, $key) && ! isset($this->value->{$key} )) | |
| 1572 | 1572 |          { | 
| 1573 | 1573 | $message = $message | 
| 1574 | 1574 | ?: sprintf( | 
| 1575 | 1575 | 'Object does not contain a property with key "%s"', | 
| 1576 | 1576 | $this->stringify($key) | 
| 1577 | 1577 | ); | 
| 1578 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTY_EXISTS, $fieldName, ['key' => $key]); | |
| 1578 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTY_EXISTS, $fieldName, [ 'key' => $key ]); | |
| 1579 | 1579 | } | 
| 1580 | 1580 | return $this; | 
| 1581 | 1581 | } | 
| @@ -1591,22 +1591,22 @@ discard block | ||
| 1591 | 1591 | */ | 
| 1592 | 1592 | public function propertiesExist(array $keys, $message = null, $fieldName = null) | 
| 1593 | 1593 |      { | 
| 1594 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1594 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1595 | 1595 |          { | 
| 1596 | 1596 | return $this; | 
| 1597 | 1597 | } | 
| 1598 | 1598 | $this->isObject($message, $fieldName); | 
| 1599 | - foreach ( $keys as $key ) | |
| 1599 | + foreach ($keys as $key) | |
| 1600 | 1600 |          { | 
| 1601 | 1601 | // Using isset to allow resolution of magically defined properties | 
| 1602 | -            if ( !property_exists($this->value, $key) && !isset( $this->value->{$key} ) ) | |
| 1602 | +            if ( ! property_exists($this->value, $key) && ! isset($this->value->{$key} )) | |
| 1603 | 1603 |              { | 
| 1604 | 1604 | $message = $message | 
| 1605 | 1605 | ?: sprintf( | 
| 1606 | 1606 | 'Object does not contain a property with key "%s"', | 
| 1607 | 1607 | $this->stringify($key) | 
| 1608 | 1608 | ); | 
| 1609 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTIES_EXIST, $fieldName, ['key' => $key]); | |
| 1609 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTIES_EXIST, $fieldName, [ 'key' => $key ]); | |
| 1610 | 1610 | } | 
| 1611 | 1611 | } | 
| 1612 | 1612 | return $this; | 
| @@ -1622,12 +1622,12 @@ discard block | ||
| 1622 | 1622 | */ | 
| 1623 | 1623 | public function utf8($message = null, $fieldName = 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->string($message, $fieldName); | 
| 1630 | - if ( mb_detect_encoding($this->value, 'UTF-8', true) !== 'UTF-8' ) | |
| 1630 | + if (mb_detect_encoding($this->value, 'UTF-8', true) !== 'UTF-8') | |
| 1631 | 1631 |          { | 
| 1632 | 1632 | $message = $message | 
| 1633 | 1633 | ?: sprintf( | 
| @@ -1650,12 +1650,12 @@ discard block | ||
| 1650 | 1650 | */ | 
| 1651 | 1651 | public function ascii($message = null, $fieldName = 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->string($message, $fieldName); | 
| 1658 | -        if ( ! preg_match('/^[ -~]+$/', $this->value) ) | |
| 1658 | +        if ( ! preg_match('/^[ -~]+$/', $this->value)) | |
| 1659 | 1659 |          { | 
| 1660 | 1660 | $message = $message | 
| 1661 | 1661 | ?: sprintf( | 
| @@ -1679,19 +1679,19 @@ discard block | ||
| 1679 | 1679 | */ | 
| 1680 | 1680 | public function keyIsset($key, $message = null, $fieldName = null) | 
| 1681 | 1681 |      { | 
| 1682 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1682 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1683 | 1683 |          { | 
| 1684 | 1684 | return $this; | 
| 1685 | 1685 | } | 
| 1686 | 1686 | $this->isArrayAccessible($message, $fieldName); | 
| 1687 | - if ( !isset( $this->value[$key] ) ) | |
| 1687 | + if ( ! isset($this->value[ $key ])) | |
| 1688 | 1688 |          { | 
| 1689 | 1689 | $message = $message ?: $this->overrideError; | 
| 1690 | 1690 | $message = sprintf( | 
| 1691 | 1691 | $message ?: 'The element with key "%s" was not found', | 
| 1692 | 1692 | $this->stringify($key) | 
| 1693 | 1693 | ); | 
| 1694 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_ISSET, $fieldName, ['key' => $key]); | |
| 1694 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_ISSET, $fieldName, [ 'key' => $key ]); | |
| 1695 | 1695 | } | 
| 1696 | 1696 | return $this; | 
| 1697 | 1697 | } | 
| @@ -1708,12 +1708,12 @@ discard block | ||
| 1708 | 1708 | */ | 
| 1709 | 1709 | public function notEmptyKey($key, $message = null, $fieldName = null) | 
| 1710 | 1710 |      { | 
| 1711 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1711 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1712 | 1712 |          { | 
| 1713 | 1713 | return $this; | 
| 1714 | 1714 | } | 
| 1715 | 1715 | $this->keyIsset($key, $message, $fieldName); | 
| 1716 | - (new Assert($this->value[$key]))->setExceptionClass($this->exceptionClass)->notEmpty($message, $fieldName); | |
| 1716 | + (new Assert($this->value[ $key ]))->setExceptionClass($this->exceptionClass)->notEmpty($message, $fieldName); | |
| 1717 | 1717 | return $this; | 
| 1718 | 1718 | } | 
| 1719 | 1719 | |
| @@ -1727,11 +1727,11 @@ discard block | ||
| 1727 | 1727 | */ | 
| 1728 | 1728 | public function notBlank($message = null, $fieldName = null) | 
| 1729 | 1729 |      { | 
| 1730 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1730 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1731 | 1731 |          { | 
| 1732 | 1732 | return $this; | 
| 1733 | 1733 | } | 
| 1734 | - if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) ) | |
| 1734 | + if (false === $this->value || (empty($this->value) && '0' != $this->value)) | |
| 1735 | 1735 |          { | 
| 1736 | 1736 | $message = $message ?: $this->overrideError; | 
| 1737 | 1737 | $message = sprintf( | 
| @@ -1754,11 +1754,11 @@ discard block | ||
| 1754 | 1754 | */ | 
| 1755 | 1755 | public function isInstanceOf($className, $message = null, $fieldName = null) | 
| 1756 | 1756 |      { | 
| 1757 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1757 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1758 | 1758 |          { | 
| 1759 | 1759 | return $this; | 
| 1760 | 1760 | } | 
| 1761 | - if ( !( $this->value instanceof $className ) ) | |
| 1761 | + if ( ! ($this->value instanceof $className)) | |
| 1762 | 1762 |          { | 
| 1763 | 1763 | $message = $message ?: $this->overrideError; | 
| 1764 | 1764 | $message = sprintf( | 
| @@ -1766,7 +1766,7 @@ discard block | ||
| 1766 | 1766 | $this->stringify($this->value), | 
| 1767 | 1767 | $className | 
| 1768 | 1768 | ); | 
| 1769 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $fieldName, ['class' => $className]); | |
| 1769 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $fieldName, [ 'class' => $className ]); | |
| 1770 | 1770 | } | 
| 1771 | 1771 | return $this; | 
| 1772 | 1772 | } | 
| @@ -1782,11 +1782,11 @@ discard block | ||
| 1782 | 1782 | */ | 
| 1783 | 1783 | public function notIsInstanceOf($className, $message = null, $fieldName = null) | 
| 1784 | 1784 |      { | 
| 1785 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1785 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1786 | 1786 |          { | 
| 1787 | 1787 | return $this; | 
| 1788 | 1788 | } | 
| 1789 | - if ( $this->value instanceof $className ) | |
| 1789 | + if ($this->value instanceof $className) | |
| 1790 | 1790 |          { | 
| 1791 | 1791 | $message = $message ?: $this->overrideError; | 
| 1792 | 1792 | $message = sprintf( | 
| @@ -1794,7 +1794,7 @@ discard block | ||
| 1794 | 1794 | $this->stringify($this->value), | 
| 1795 | 1795 | $className | 
| 1796 | 1796 | ); | 
| 1797 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $fieldName, ['class' => $className]); | |
| 1797 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $fieldName, [ 'class' => $className ]); | |
| 1798 | 1798 | } | 
| 1799 | 1799 | return $this; | 
| 1800 | 1800 | } | 
| @@ -1810,11 +1810,11 @@ discard block | ||
| 1810 | 1810 | */ | 
| 1811 | 1811 | public function subclassOf($className, $message = null, $fieldName = null) | 
| 1812 | 1812 |      { | 
| 1813 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1813 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1814 | 1814 |          { | 
| 1815 | 1815 | return $this; | 
| 1816 | 1816 | } | 
| 1817 | - if ( !is_subclass_of($this->value, $className) ) | |
| 1817 | + if ( ! is_subclass_of($this->value, $className)) | |
| 1818 | 1818 |          { | 
| 1819 | 1819 | $message = $message ?: $this->overrideError; | 
| 1820 | 1820 | $message = sprintf( | 
| @@ -1822,7 +1822,7 @@ discard block | ||
| 1822 | 1822 | $this->stringify($this->value), | 
| 1823 | 1823 | $className | 
| 1824 | 1824 | ); | 
| 1825 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $fieldName, ['class' => $className]); | |
| 1825 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $fieldName, [ 'class' => $className ]); | |
| 1826 | 1826 | } | 
| 1827 | 1827 | return $this; | 
| 1828 | 1828 | } | 
| @@ -1839,12 +1839,12 @@ discard block | ||
| 1839 | 1839 | */ | 
| 1840 | 1840 | public function range($minValue, $maxValue, $message = null, $fieldName = null) | 
| 1841 | 1841 |      { | 
| 1842 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1842 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1843 | 1843 |          { | 
| 1844 | 1844 | return $this; | 
| 1845 | 1845 | } | 
| 1846 | 1846 | $this->numeric($message, $fieldName); | 
| 1847 | - if ( $this->value < $minValue || $this->value > $maxValue ) | |
| 1847 | + if ($this->value < $minValue || $this->value > $maxValue) | |
| 1848 | 1848 |          { | 
| 1849 | 1849 | $message = $message ?: $this->overrideError; | 
| 1850 | 1850 | $message = sprintf( | 
| @@ -1872,12 +1872,12 @@ discard block | ||
| 1872 | 1872 | */ | 
| 1873 | 1873 | public function min($minValue, $message = null, $fieldName = null) | 
| 1874 | 1874 |      { | 
| 1875 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1875 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1876 | 1876 |          { | 
| 1877 | 1877 | return $this; | 
| 1878 | 1878 | } | 
| 1879 | 1879 | $this->numeric($message, $fieldName); | 
| 1880 | - if ( $this->value < $minValue ) | |
| 1880 | + if ($this->value < $minValue) | |
| 1881 | 1881 |          { | 
| 1882 | 1882 | $message = $message ?: $this->overrideError; | 
| 1883 | 1883 | $message = sprintf( | 
| @@ -1885,7 +1885,7 @@ discard block | ||
| 1885 | 1885 | $this->stringify($this->value), | 
| 1886 | 1886 | $this->stringify($minValue) | 
| 1887 | 1887 | ); | 
| 1888 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $fieldName, ['min' => $minValue]); | |
| 1888 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $fieldName, [ 'min' => $minValue ]); | |
| 1889 | 1889 | } | 
| 1890 | 1890 | return $this; | 
| 1891 | 1891 | } | 
| @@ -1901,12 +1901,12 @@ discard block | ||
| 1901 | 1901 | */ | 
| 1902 | 1902 | public function max($maxValue, $message = null, $fieldName = null) | 
| 1903 | 1903 |      { | 
| 1904 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1904 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1905 | 1905 |          { | 
| 1906 | 1906 | return $this; | 
| 1907 | 1907 | } | 
| 1908 | 1908 | $this->numeric($message, $fieldName); | 
| 1909 | - if ( $this->value > $maxValue ) | |
| 1909 | + if ($this->value > $maxValue) | |
| 1910 | 1910 |          { | 
| 1911 | 1911 | $message = $message ?: $this->overrideError; | 
| 1912 | 1912 | $message = sprintf( | 
| @@ -1914,7 +1914,7 @@ discard block | ||
| 1914 | 1914 | $this->stringify($this->value), | 
| 1915 | 1915 | $this->stringify($maxValue) | 
| 1916 | 1916 | ); | 
| 1917 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $fieldName, ['max' => $maxValue]); | |
| 1917 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $fieldName, [ 'max' => $maxValue ]); | |
| 1918 | 1918 | } | 
| 1919 | 1919 | return $this; | 
| 1920 | 1920 | } | 
| @@ -1929,13 +1929,13 @@ discard block | ||
| 1929 | 1929 | */ | 
| 1930 | 1930 | public function file($message = null, $fieldName = null) | 
| 1931 | 1931 |      { | 
| 1932 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1932 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1933 | 1933 |          { | 
| 1934 | 1934 | return $this; | 
| 1935 | 1935 | } | 
| 1936 | 1936 | $this->string($message, $fieldName); | 
| 1937 | 1937 | $this->notEmpty($message, $fieldName); | 
| 1938 | - if ( !is_file($this->value) ) | |
| 1938 | + if ( ! is_file($this->value)) | |
| 1939 | 1939 |          { | 
| 1940 | 1940 | $message = $message ?: $this->overrideError; | 
| 1941 | 1941 | $message = sprintf( | 
| @@ -1957,13 +1957,13 @@ discard block | ||
| 1957 | 1957 | */ | 
| 1958 | 1958 | public function fileOrDirectoryExists($message = null, $fieldName = null) | 
| 1959 | 1959 |      { | 
| 1960 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1960 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1961 | 1961 |          { | 
| 1962 | 1962 | return $this; | 
| 1963 | 1963 | } | 
| 1964 | 1964 | $this->string($message, $fieldName); | 
| 1965 | 1965 | $this->notEmpty($message, $fieldName); | 
| 1966 | - if ( ! file_exists($this->value) ) | |
| 1966 | + if ( ! file_exists($this->value)) | |
| 1967 | 1967 |          { | 
| 1968 | 1968 | $message = $message ?: $this->overrideError; | 
| 1969 | 1969 | $message = sprintf( | 
| @@ -1985,12 +1985,12 @@ discard block | ||
| 1985 | 1985 | */ | 
| 1986 | 1986 | public function directory($message = null, $fieldName = null) | 
| 1987 | 1987 |      { | 
| 1988 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1988 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1989 | 1989 |          { | 
| 1990 | 1990 | return $this; | 
| 1991 | 1991 | } | 
| 1992 | 1992 | $this->string($message, $fieldName); | 
| 1993 | - if ( !is_dir($this->value) ) | |
| 1993 | + if ( ! is_dir($this->value)) | |
| 1994 | 1994 |          { | 
| 1995 | 1995 | $message = $message ?: $this->overrideError; | 
| 1996 | 1996 | $message = sprintf( | 
| @@ -2012,12 +2012,12 @@ discard block | ||
| 2012 | 2012 | */ | 
| 2013 | 2013 | public function readable($message = null, $fieldName = null) | 
| 2014 | 2014 |      { | 
| 2015 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2015 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2016 | 2016 |          { | 
| 2017 | 2017 | return $this; | 
| 2018 | 2018 | } | 
| 2019 | 2019 | $this->string($message, $fieldName); | 
| 2020 | - if ( !is_readable($this->value) ) | |
| 2020 | + if ( ! is_readable($this->value)) | |
| 2021 | 2021 |          { | 
| 2022 | 2022 | $message = $message ?: $this->overrideError; | 
| 2023 | 2023 | $message = sprintf( | 
| @@ -2039,12 +2039,12 @@ discard block | ||
| 2039 | 2039 | */ | 
| 2040 | 2040 | public function writeable($message = null, $fieldName = null) | 
| 2041 | 2041 |      { | 
| 2042 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2042 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2043 | 2043 |          { | 
| 2044 | 2044 | return $this; | 
| 2045 | 2045 | } | 
| 2046 | 2046 | $this->string($message, $fieldName); | 
| 2047 | - if ( !is_writeable($this->value) ) | |
| 2047 | + if ( ! is_writeable($this->value)) | |
| 2048 | 2048 |          { | 
| 2049 | 2049 | $message = $message ?: $this->overrideError; | 
| 2050 | 2050 | $message = sprintf( | 
| @@ -2066,12 +2066,12 @@ discard block | ||
| 2066 | 2066 | */ | 
| 2067 | 2067 | public function email($message = null, $fieldName = 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, $fieldName); | 
| 2074 | - if ( ! filter_var($this->value, FILTER_VALIDATE_EMAIL) ) | |
| 2074 | + if ( ! filter_var($this->value, FILTER_VALIDATE_EMAIL)) | |
| 2075 | 2075 |          { | 
| 2076 | 2076 | $message = $message ?: $this->overrideError; | 
| 2077 | 2077 | $message = sprintf( | 
| @@ -2084,7 +2084,7 @@ discard block | ||
| 2084 | 2084 |          { | 
| 2085 | 2085 | $host = substr($this->value, strpos($this->value, '@') + 1); | 
| 2086 | 2086 | // Likely not a FQDN, bug in PHP FILTER_VALIDATE_EMAIL prior to PHP 5.3.3 | 
| 2087 | - if ( version_compare(PHP_VERSION, '5.3.3', '<') && strpos($host, '.') === false ) | |
| 2087 | + if (version_compare(PHP_VERSION, '5.3.3', '<') && strpos($host, '.') === false) | |
| 2088 | 2088 |              { | 
| 2089 | 2089 | $message = $message ?: $this->overrideError; | 
| 2090 | 2090 | $message = sprintf( | 
| @@ -2107,7 +2107,7 @@ discard block | ||
| 2107 | 2107 | */ | 
| 2108 | 2108 | public function emailPrefix($message = null, $fieldName = null) | 
| 2109 | 2109 |      { | 
| 2110 | - $this->value($this->value . '@example.com'); | |
| 2110 | + $this->value($this->value.'@example.com'); | |
| 2111 | 2111 | return $this->email($message, $fieldName); | 
| 2112 | 2112 | } | 
| 2113 | 2113 | |
| @@ -2127,12 +2127,12 @@ discard block | ||
| 2127 | 2127 | */ | 
| 2128 | 2128 | public function url($message = null, $fieldName = null) | 
| 2129 | 2129 |      { | 
| 2130 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2130 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2131 | 2131 |          { | 
| 2132 | 2132 | return $this; | 
| 2133 | 2133 | } | 
| 2134 | 2134 | $this->string($message, $fieldName); | 
| 2135 | - $protocols = ['http', 'https']; | |
| 2135 | + $protocols = [ 'http', 'https' ]; | |
| 2136 | 2136 | $pattern = '~^ | 
| 2137 | 2137 | (%s):// # protocol | 
| 2138 | 2138 | ( | 
| @@ -2147,8 +2147,8 @@ discard block | ||
| 2147 | 2147 | (:[0-9]+)? # a port (optional) | 
| 2148 | 2148 | (/?|/\S+) # a /, nothing or a / with something | 
| 2149 | 2149 | $~ixu'; | 
| 2150 | -        $pattern   = sprintf($pattern, implode('|', $protocols)); | |
| 2151 | - if ( !preg_match($pattern, $this->value) ) | |
| 2150 | +        $pattern = sprintf($pattern, implode('|', $protocols)); | |
| 2151 | + if ( ! preg_match($pattern, $this->value)) | |
| 2152 | 2152 |          { | 
| 2153 | 2153 | $message = $message ?: $this->overrideError; | 
| 2154 | 2154 | $message = sprintf( | 
| @@ -2173,13 +2173,13 @@ discard block | ||
| 2173 | 2173 | */ | 
| 2174 | 2174 | public function domainName($message = null, $fieldName = null) | 
| 2175 | 2175 |      { | 
| 2176 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2176 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2177 | 2177 |          { | 
| 2178 | 2178 | return $this; | 
| 2179 | 2179 | } | 
| 2180 | 2180 | $this->string($message, $fieldName); | 
| 2181 | -        $pattern   = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/'; | |
| 2182 | - if ( ! preg_match($pattern, $this->value) ) | |
| 2181 | +        $pattern = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/'; | |
| 2182 | + if ( ! preg_match($pattern, $this->value)) | |
| 2183 | 2183 |          { | 
| 2184 | 2184 | $message = $message ?: $this->overrideError; | 
| 2185 | 2185 | $message = sprintf( | 
| @@ -2201,7 +2201,7 @@ discard block | ||
| 2201 | 2201 | */ | 
| 2202 | 2202 | public function ausMobile($message = null, $fieldName = 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 | } | 
| @@ -2209,7 +2209,7 @@ discard block | ||
| 2209 | 2209 |          { | 
| 2210 | 2210 |              $this->regex('/^04[0-9]{8})$/', $message, $fieldName); | 
| 2211 | 2211 | } | 
| 2212 | - catch ( AssertionFailedException $e ) | |
| 2212 | + catch (AssertionFailedException $e) | |
| 2213 | 2213 |          { | 
| 2214 | 2214 | $message = $message ?: $this->overrideError; | 
| 2215 | 2215 | $message = sprintf( | 
| @@ -2232,7 +2232,7 @@ discard block | ||
| 2232 | 2232 | */ | 
| 2233 | 2233 | public function alnum($message = null, $fieldName = null) | 
| 2234 | 2234 |      { | 
| 2235 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2235 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2236 | 2236 |          { | 
| 2237 | 2237 | return $this; | 
| 2238 | 2238 | } | 
| @@ -2263,11 +2263,11 @@ discard block | ||
| 2263 | 2263 | */ | 
| 2264 | 2264 | public function true($message = null, $fieldName = null) | 
| 2265 | 2265 |      { | 
| 2266 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2266 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2267 | 2267 |          { | 
| 2268 | 2268 | return $this; | 
| 2269 | 2269 | } | 
| 2270 | - if ( $this->value !== true ) | |
| 2270 | + if ($this->value !== true) | |
| 2271 | 2271 |          { | 
| 2272 | 2272 | $message = $message ?: $this->overrideError; | 
| 2273 | 2273 | $message = sprintf( | 
| @@ -2290,11 +2290,11 @@ discard block | ||
| 2290 | 2290 | */ | 
| 2291 | 2291 | public function truthy($message = null, $fieldName = null) | 
| 2292 | 2292 |      { | 
| 2293 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2293 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2294 | 2294 |          { | 
| 2295 | 2295 | return $this; | 
| 2296 | 2296 | } | 
| 2297 | - if ( ! $this->value ) | |
| 2297 | + if ( ! $this->value) | |
| 2298 | 2298 |          { | 
| 2299 | 2299 | $message = $message ?: $this->overrideError; | 
| 2300 | 2300 | $message = sprintf( | 
| @@ -2316,11 +2316,11 @@ discard block | ||
| 2316 | 2316 | */ | 
| 2317 | 2317 | public function false($message = null, $fieldName = 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 | - if ( $this->value !== false ) | |
| 2323 | + if ($this->value !== false) | |
| 2324 | 2324 |          { | 
| 2325 | 2325 | $message = $message ?: $this->overrideError; | 
| 2326 | 2326 | $message = sprintf( | 
| @@ -2342,11 +2342,11 @@ discard block | ||
| 2342 | 2342 | */ | 
| 2343 | 2343 | public function notFalse($message = null, $fieldName = null) | 
| 2344 | 2344 |      { | 
| 2345 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2345 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2346 | 2346 |          { | 
| 2347 | 2347 | return $this; | 
| 2348 | 2348 | } | 
| 2349 | - if ( $this->value === false ) | |
| 2349 | + if ($this->value === false) | |
| 2350 | 2350 |          { | 
| 2351 | 2351 | $message = $message ?: $this->overrideError; | 
| 2352 | 2352 | $message = sprintf( | 
| @@ -2368,11 +2368,11 @@ discard block | ||
| 2368 | 2368 | */ | 
| 2369 | 2369 | public function classExists($message = null, $fieldName = 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 ( !class_exists($this->value) ) | |
| 2375 | + if ( ! class_exists($this->value)) | |
| 2376 | 2376 |          { | 
| 2377 | 2377 | $message = $message ?: $this->overrideError; | 
| 2378 | 2378 | $message = sprintf( | 
| @@ -2395,12 +2395,12 @@ discard block | ||
| 2395 | 2395 | */ | 
| 2396 | 2396 | public function implementsInterface($interfaceName, $message = null, $fieldName = null) | 
| 2397 | 2397 |      { | 
| 2398 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2398 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2399 | 2399 |          { | 
| 2400 | 2400 | return $this; | 
| 2401 | 2401 | } | 
| 2402 | 2402 | $reflection = new \ReflectionClass($this->value); | 
| 2403 | - if ( !$reflection->implementsInterface($interfaceName) ) | |
| 2403 | + if ( ! $reflection->implementsInterface($interfaceName)) | |
| 2404 | 2404 |          { | 
| 2405 | 2405 | $message = $message ?: $this->overrideError; | 
| 2406 | 2406 | $message = sprintf( | 
| @@ -2408,7 +2408,7 @@ discard block | ||
| 2408 | 2408 | $this->stringify($this->value), | 
| 2409 | 2409 | $this->stringify($interfaceName) | 
| 2410 | 2410 | ); | 
| 2411 | - throw $this->createException($message, self::INTERFACE_NOT_IMPLEMENTED, $fieldName, ['interface' => $interfaceName]); | |
| 2411 | + throw $this->createException($message, self::INTERFACE_NOT_IMPLEMENTED, $fieldName, [ 'interface' => $interfaceName ]); | |
| 2412 | 2412 | } | 
| 2413 | 2413 | return $this; | 
| 2414 | 2414 | } | 
| @@ -2429,11 +2429,11 @@ discard block | ||
| 2429 | 2429 | */ | 
| 2430 | 2430 | public function isJsonString($message = null, $fieldName = null) | 
| 2431 | 2431 |      { | 
| 2432 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2432 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2433 | 2433 |          { | 
| 2434 | 2434 | return $this; | 
| 2435 | 2435 | } | 
| 2436 | - if ( null === json_decode($this->value) && JSON_ERROR_NONE !== json_last_error() ) | |
| 2436 | + if (null === json_decode($this->value) && JSON_ERROR_NONE !== json_last_error()) | |
| 2437 | 2437 |          { | 
| 2438 | 2438 | $message = $message ?: $this->overrideError; | 
| 2439 | 2439 | $message = sprintf( | 
| @@ -2457,16 +2457,16 @@ discard block | ||
| 2457 | 2457 | */ | 
| 2458 | 2458 | public function uuid($message = null, $fieldName = 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 | } | 
| 2464 | -        $this->value = str_replace(['urn:', 'uuid:', '{', '}'], '', $this->value); | |
| 2465 | - if ( $this->value === '00000000-0000-0000-0000-000000000000' ) | |
| 2464 | +        $this->value = str_replace([ 'urn:', 'uuid:', '{', '}' ], '', $this->value); | |
| 2465 | + if ($this->value === '00000000-0000-0000-0000-000000000000') | |
| 2466 | 2466 |          { | 
| 2467 | 2467 | return $this; | 
| 2468 | 2468 | } | 
| 2469 | -        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) ) | |
| 2469 | +        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)) | |
| 2470 | 2470 |          { | 
| 2471 | 2471 | $message = $message ?: $this->overrideError; | 
| 2472 | 2472 | $message = sprintf( | 
| @@ -2495,11 +2495,11 @@ discard block | ||
| 2495 | 2495 | */ | 
| 2496 | 2496 | public function samAccountName($message = null, $fieldName = null) | 
| 2497 | 2497 |      { | 
| 2498 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2498 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2499 | 2499 |          { | 
| 2500 | 2500 | return $this; | 
| 2501 | 2501 | } | 
| 2502 | -        if ( !preg_match('/^([a-z0-9]{4,20})$/', $this->value) ) | |
| 2502 | +        if ( ! preg_match('/^([a-z0-9]{4,20})$/', $this->value)) | |
| 2503 | 2503 |          { | 
| 2504 | 2504 | $message = $message ?: $this->overrideError; | 
| 2505 | 2505 | $message = sprintf( | 
| @@ -2521,7 +2521,7 @@ discard block | ||
| 2521 | 2521 | */ | 
| 2522 | 2522 | public function userPrincipalName($message = null, $fieldName = null) | 
| 2523 | 2523 |      { | 
| 2524 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2524 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2525 | 2525 |          { | 
| 2526 | 2526 | return $this; | 
| 2527 | 2527 | } | 
| @@ -2553,11 +2553,11 @@ discard block | ||
| 2553 | 2553 | */ | 
| 2554 | 2554 | public function count($count, $message = null, $fieldName = null) | 
| 2555 | 2555 |      { | 
| 2556 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2556 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2557 | 2557 |          { | 
| 2558 | 2558 | return $this; | 
| 2559 | 2559 | } | 
| 2560 | - if ( $count !== count($this->value) ) | |
| 2560 | + if ($count !== count($this->value)) | |
| 2561 | 2561 |          { | 
| 2562 | 2562 | $message = $message ?: $this->overrideError; | 
| 2563 | 2563 | $message = sprintf( | 
| @@ -2565,7 +2565,7 @@ discard block | ||
| 2565 | 2565 | $this->stringify($this->value), | 
| 2566 | 2566 | $this->stringify($count) | 
| 2567 | 2567 | ); | 
| 2568 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $fieldName, ['count' => $count]); | |
| 2568 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $fieldName, [ 'count' => $count ]); | |
| 2569 | 2569 | } | 
| 2570 | 2570 | return $this; | 
| 2571 | 2571 | } | 
| @@ -2578,24 +2578,24 @@ discard block | ||
| 2578 | 2578 | */ | 
| 2579 | 2579 | protected function doAllOrNullOr($func, $args) | 
| 2580 | 2580 |      { | 
| 2581 | - if ( $this->nullOr && is_null($this->value) ) | |
| 2581 | + if ($this->nullOr && is_null($this->value)) | |
| 2582 | 2582 |          { | 
| 2583 | 2583 | return true; | 
| 2584 | 2584 | } | 
| 2585 | - if ( $this->emptyOr && empty($this->value) ) | |
| 2585 | + if ($this->emptyOr && empty($this->value)) | |
| 2586 | 2586 |          { | 
| 2587 | 2587 | return true; | 
| 2588 | 2588 | } | 
| 2589 | - if ( $this->all && (new Assert($this->value))->setExceptionClass($this->exceptionClass)->isTraversable() ) | |
| 2589 | + if ($this->all && (new Assert($this->value))->setExceptionClass($this->exceptionClass)->isTraversable()) | |
| 2590 | 2590 |          { | 
| 2591 | - foreach ( $this->value as $idx => $value ) | |
| 2591 | + foreach ($this->value as $idx => $value) | |
| 2592 | 2592 |              { | 
| 2593 | 2593 | $object = (new Assert($value))->setExceptionClass($this->exceptionClass); | 
| 2594 | - call_user_func_array([$object, $func], $args); | |
| 2594 | + call_user_func_array([ $object, $func ], $args); | |
| 2595 | 2595 | } | 
| 2596 | 2596 | return true; | 
| 2597 | 2597 | } | 
| 2598 | - return ( $this->nullOr && is_null($this->value) ) || ( $this->emptyOr && empty($this->value) ) ? true : false; | |
| 2598 | + return ($this->nullOr && is_null($this->value)) || ($this->emptyOr && empty($this->value)) ? true : false; | |
| 2599 | 2599 | } | 
| 2600 | 2600 | |
| 2601 | 2601 | /** | 
| @@ -2609,12 +2609,12 @@ discard block | ||
| 2609 | 2609 | */ | 
| 2610 | 2610 | public function choicesNotEmpty(array $choices, $message = null, $fieldName = null) | 
| 2611 | 2611 |      { | 
| 2612 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2612 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2613 | 2613 |          { | 
| 2614 | 2614 | return $this; | 
| 2615 | 2615 | } | 
| 2616 | 2616 | $this->notEmpty($message, $fieldName); | 
| 2617 | - foreach ( $choices as $choice ) | |
| 2617 | + foreach ($choices as $choice) | |
| 2618 | 2618 |          { | 
| 2619 | 2619 | $this->notEmptyKey($choice, $message, $fieldName); | 
| 2620 | 2620 | } | 
| @@ -2632,12 +2632,12 @@ discard block | ||
| 2632 | 2632 | */ | 
| 2633 | 2633 | public function methodExists($object, $message = null, $fieldName = null) | 
| 2634 | 2634 |      { | 
| 2635 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2635 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2636 | 2636 |          { | 
| 2637 | 2637 | return $this; | 
| 2638 | 2638 | } | 
| 2639 | 2639 | (new Assert($object))->setExceptionClass($this->exceptionClass)->isObject($message, $fieldName); | 
| 2640 | - if ( !method_exists($object, $this->value) ) | |
| 2640 | + if ( ! method_exists($object, $this->value)) | |
| 2641 | 2641 |          { | 
| 2642 | 2642 | $message = $message ?: $this->overrideError; | 
| 2643 | 2643 | $message = sprintf( | 
| @@ -2659,11 +2659,11 @@ discard block | ||
| 2659 | 2659 | */ | 
| 2660 | 2660 | public function isObject($message = null, $fieldName = null) | 
| 2661 | 2661 |      { | 
| 2662 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2662 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2663 | 2663 |          { | 
| 2664 | 2664 | return $this; | 
| 2665 | 2665 | } | 
| 2666 | - if ( !is_object($this->value) ) | |
| 2666 | + if ( ! is_object($this->value)) | |
| 2667 | 2667 |          { | 
| 2668 | 2668 | $message = $message ?: $this->overrideError; | 
| 2669 | 2669 | $message = sprintf( | 
| @@ -2683,32 +2683,32 @@ discard block | ||
| 2683 | 2683 | */ | 
| 2684 | 2684 | private function stringify($value) | 
| 2685 | 2685 |      { | 
| 2686 | - if ( is_bool($value) ) | |
| 2686 | + if (is_bool($value)) | |
| 2687 | 2687 |          { | 
| 2688 | 2688 | return $value ? '<TRUE>' : '<FALSE>'; | 
| 2689 | 2689 | } | 
| 2690 | - if ( is_scalar($value) ) | |
| 2690 | + if (is_scalar($value)) | |
| 2691 | 2691 |          { | 
| 2692 | 2692 | $val = (string)$value; | 
| 2693 | - if ( strlen($val) > 100 ) | |
| 2693 | + if (strlen($val) > 100) | |
| 2694 | 2694 |              { | 
| 2695 | - $val = substr($val, 0, 97) . '...'; | |
| 2695 | + $val = substr($val, 0, 97).'...'; | |
| 2696 | 2696 | } | 
| 2697 | 2697 | return $val; | 
| 2698 | 2698 | } | 
| 2699 | - if ( is_array($value) ) | |
| 2699 | + if (is_array($value)) | |
| 2700 | 2700 |          { | 
| 2701 | 2701 | return '<ARRAY>'; | 
| 2702 | 2702 | } | 
| 2703 | - if ( is_object($value) ) | |
| 2703 | + if (is_object($value)) | |
| 2704 | 2704 |          { | 
| 2705 | 2705 | return get_class($value); | 
| 2706 | 2706 | } | 
| 2707 | - if ( is_resource($value) ) | |
| 2707 | + if (is_resource($value)) | |
| 2708 | 2708 |          { | 
| 2709 | 2709 | return '<RESOURCE>'; | 
| 2710 | 2710 | } | 
| 2711 | - if ( $value === null ) | |
| 2711 | + if ($value === null) | |
| 2712 | 2712 |          { | 
| 2713 | 2713 | return '<NULL>'; | 
| 2714 | 2714 | } | 
| @@ -157,8 +157,7 @@ discard block | ||
| 157 | 157 | try | 
| 158 | 158 |              { | 
| 159 | 159 | $validator->__invoke(); | 
| 160 | - } | |
| 161 | - catch ( AssertionFailedException $e ) | |
| 160 | + } catch ( AssertionFailedException $e ) | |
| 162 | 161 |              { | 
| 163 | 162 | $errors[$fieldName] = $e->getMessage(); | 
| 164 | 163 | } | 
| @@ -2079,8 +2078,7 @@ discard block | ||
| 2079 | 2078 | $this->stringify($this->value) | 
| 2080 | 2079 | ); | 
| 2081 | 2080 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_EMAIL, $fieldName); | 
| 2082 | - } | |
| 2083 | - else | |
| 2081 | + } else | |
| 2084 | 2082 |          { | 
| 2085 | 2083 | $host = substr($this->value, strpos($this->value, '@') + 1); | 
| 2086 | 2084 | // Likely not a FQDN, bug in PHP FILTER_VALIDATE_EMAIL prior to PHP 5.3.3 | 
| @@ -2208,8 +2206,7 @@ discard block | ||
| 2208 | 2206 | try | 
| 2209 | 2207 |          { | 
| 2210 | 2208 |              $this->regex('/^04[0-9]{8})$/', $message, $fieldName); | 
| 2211 | - } | |
| 2212 | - catch ( AssertionFailedException $e ) | |
| 2209 | + } catch ( AssertionFailedException $e ) | |
| 2213 | 2210 |          { | 
| 2214 | 2211 | $message = $message ?: $this->overrideError; | 
| 2215 | 2212 | $message = sprintf( | 
| @@ -2239,8 +2236,7 @@ discard block | ||
| 2239 | 2236 | try | 
| 2240 | 2237 |          { | 
| 2241 | 2238 |              $this->regex('(^([a-zA-Z]{1}[a-zA-Z0-9]*)$)', $message, $fieldName); | 
| 2242 | - } | |
| 2243 | - catch (AssertionFailedException $e) | |
| 2239 | + } catch (AssertionFailedException $e) | |
| 2244 | 2240 |          { | 
| 2245 | 2241 | $message = $message ?: $this->overrideError; | 
| 2246 | 2242 | $message = sprintf( | 
| @@ -2528,8 +2524,7 @@ discard block | ||
| 2528 | 2524 | try | 
| 2529 | 2525 |          { | 
| 2530 | 2526 | $this->email($message, $fieldName); | 
| 2531 | - } | |
| 2532 | - catch (AssertionFailedException $e) | |
| 2527 | + } catch (AssertionFailedException $e) | |
| 2533 | 2528 |          { | 
| 2534 | 2529 | $message = $message ?: $this->overrideError; | 
| 2535 | 2530 | $message = sprintf( | 
| @@ -1,4 +1,4 @@ discard block | ||
| 1 | -<?php declare(strict_types=1); | |
| 1 | +<?php declare(strict_types = 1); | |
| 2 | 2 | |
| 3 | 3 | namespace Terah\Assert; | 
| 4 | 4 | |
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | * @param array $constraints | 
| 41 | 41 | * @param string $level | 
| 42 | 42 | */ | 
| 43 | - public function __construct(string $message, int $code, string $fieldName = null, $value, array $constraints=[], string $level='critical', string $propertyPath = null) | |
| 43 | + public function __construct(string $message, int $code, string $fieldName = null, $value, array $constraints = [ ], string $level = 'critical', string $propertyPath = null) | |
| 44 | 44 |      { | 
| 45 | 45 | parent::__construct($message, $code); | 
| 46 | 46 | $this->fieldName = $fieldName; | 
| @@ -48,14 +48,14 @@ discard block | ||
| 48 | 48 | $this->constraints = $constraints; | 
| 49 | 49 | $this->level = $level; | 
| 50 | 50 | $this->propertyPath = $propertyPath; | 
| 51 | - foreach ( $this->getTrace() as $point ) | |
| 51 | + foreach ($this->getTrace() as $point) | |
| 52 | 52 |          { | 
| 53 | - if ( $this->location ) | |
| 53 | + if ($this->location) | |
| 54 | 54 |              { | 
| 55 | 55 | continue; | 
| 56 | 56 | } | 
| 57 | - $class = $point['class'] ??0?: ''; | |
| 58 | - if ( $class !== 'Terah\\Assert\\Assert' ) | |
| 57 | + $class = $point[ 'class' ] ??0 ?: ''; | |
| 58 | + if ($class !== 'Terah\\Assert\\Assert') | |
| 59 | 59 |              { | 
| 60 | 60 | $this->location = (object)$point; | 
| 61 | 61 | } | 
| @@ -123,7 +123,7 @@ discard block | ||
| 123 | 123 | */ | 
| 124 | 124 | public function getPropertyPathAndCallingLocation() : string | 
| 125 | 125 |      { | 
| 126 | - return $this->getPropertyPath() . ' in ' . $this->getCallingFileAndLine(); | |
| 126 | + return $this->getPropertyPath().' in '.$this->getCallingFileAndLine(); | |
| 127 | 127 | } | 
| 128 | 128 | |
| 129 | 129 | /** | 
| @@ -134,15 +134,15 @@ discard block | ||
| 134 | 134 | */ | 
| 135 | 135 | protected function getCallingFileAndLine() : string | 
| 136 | 136 |      { | 
| 137 | - foreach ( $this->getTrace() as $trace ) | |
| 137 | + foreach ($this->getTrace() as $trace) | |
| 138 | 138 |          { | 
| 139 | 139 | $trace = (object)$trace; | 
| 140 | - if ( empty($trace->file) ) | |
| 140 | + if (empty($trace->file)) | |
| 141 | 141 |              { | 
| 142 | 142 | continue; | 
| 143 | 143 | } | 
| 144 | 144 |              $file = static::beforeLast('.php', static::afterLast('/', $trace->file)); | 
| 145 | - if ( in_array($file, ['AssertionChain', 'Assertion']) ) | |
| 145 | + if (in_array($file, [ 'AssertionChain', 'Assertion' ])) | |
| 146 | 146 |              { | 
| 147 | 147 | continue; | 
| 148 | 148 | } | 
| @@ -169,9 +169,9 @@ discard block | ||
| 169 | 169 | * @param bool $return_original | 
| 170 | 170 | * @return string | 
| 171 | 171 | */ | 
| 172 | - public static function afterLast(string $needle, string $haystack, bool $return_original=false) : string | |
| 172 | + public static function afterLast(string $needle, string $haystack, bool $return_original = false) : string | |
| 173 | 173 |      { | 
| 174 | - if ( static::strrevpos($haystack, $needle) !== -1 ) | |
| 174 | + if (static::strrevpos($haystack, $needle) !== -1) | |
| 175 | 175 |          { | 
| 176 | 176 | return mb_substr($haystack, static::strrevpos($haystack, $needle) + mb_strlen($needle)); | 
| 177 | 177 | } | 
| @@ -198,7 +198,7 @@ discard block | ||
| 198 | 198 | */ | 
| 199 | 199 | public static function beforeLast(string $needle, string $haystack) : string | 
| 200 | 200 |      { | 
| 201 | - $position = static::strrevpos($haystack, $needle); | |
| 201 | + $position = static::strrevpos($haystack, $needle); | |
| 202 | 202 | |
| 203 | 203 | return $position === -1 ? '' : mb_substr($haystack, 0, static::strrevpos($haystack, $needle)); | 
| 204 | 204 | } |