| @@ -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 | |
| @@ -60,7 +60,7 @@ discard block | ||
| 60 | 60 | const INVALID_TRAVERSABLE = 44; | 
| 61 | 61 | const INVALID_ARRAY_ACCESSIBLE = 45; | 
| 62 | 62 | const INVALID_KEY_ISSET = 46; | 
| 63 | - const INVALID_SAMACCOUNTNAME = 47; | |
| 63 | + const INVALID_SAMACCOUNTNAME = 47; | |
| 64 | 64 | const INVALID_DIRECTORY = 101; | 
| 65 | 65 | const INVALID_FILE = 102; | 
| 66 | 66 | const INVALID_READABLE = 103; | 
| @@ -130,7 +130,7 @@ discard block | ||
| 130 | 130 | * | 
| 131 | 131 | * @var string | 
| 132 | 132 | */ | 
| 133 | - protected $exceptionClass = 'Terah\Assert\AssertionFailedException'; | |
| 133 | + protected $exceptionClass = 'Terah\Assert\AssertionFailedException'; | |
| 134 | 134 | |
| 135 | 135 | /** | 
| 136 | 136 | * @param mixed $value | 
| @@ -148,22 +148,22 @@ discard block | ||
| 148 | 148 | * @param string $level | 
| 149 | 149 | * @return Assert | 
| 150 | 150 | */ | 
| 151 | - public static function that($value, $name='', $code=0, $error='', $level=Assert::WARNING) | |
| 151 | + public static function that($value, $name = '', $code = 0, $error = '', $level = Assert::WARNING) | |
| 152 | 152 |      { | 
| 153 | 153 | $assert = new static($value); | 
| 154 | - if ( $name ) | |
| 154 | + if ($name) | |
| 155 | 155 |          { | 
| 156 | 156 | $assert->name($name); | 
| 157 | 157 | } | 
| 158 | - if ( $code ) | |
| 158 | + if ($code) | |
| 159 | 159 |          { | 
| 160 | 160 | $assert->code($code); | 
| 161 | 161 | } | 
| 162 | - if ( $error ) | |
| 162 | + if ($error) | |
| 163 | 163 |          { | 
| 164 | 164 | $assert->error($error); | 
| 165 | 165 | } | 
| 166 | - if ( $level ) | |
| 166 | + if ($level) | |
| 167 | 167 |          { | 
| 168 | 168 | $assert->level($level); | 
| 169 | 169 | } | 
| @@ -232,7 +232,7 @@ discard block | ||
| 232 | 232 | * @param string $level | 
| 233 | 233 | * @return AssertionFailedException | 
| 234 | 234 | */ | 
| 235 | - protected function createException($message, $code, $propertyPath, array $constraints = [], $level=null) | |
| 235 | + protected function createException($message, $code, $propertyPath, array $constraints = [ ], $level = null) | |
| 236 | 236 |      { | 
| 237 | 237 | $exceptionClass = $this->exceptionClass; | 
| 238 | 238 | $propertyPath = is_null($propertyPath) ? $this->propertyPath : $propertyPath; | 
| @@ -302,11 +302,11 @@ discard block | ||
| 302 | 302 | */ | 
| 303 | 303 | public function eq($value2, $message = null, $propertyPath = null) | 
| 304 | 304 |      { | 
| 305 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 305 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 306 | 306 |          { | 
| 307 | 307 | return $this; | 
| 308 | 308 | } | 
| 309 | - if ( $this->value != $value2 ) | |
| 309 | + if ($this->value != $value2) | |
| 310 | 310 |          { | 
| 311 | 311 | $message = $message ?: $this->overrideError; | 
| 312 | 312 | $message = sprintf( | 
| @@ -314,7 +314,7 @@ discard block | ||
| 314 | 314 | $this->stringify($this->value), | 
| 315 | 315 | $this->stringify($value2) | 
| 316 | 316 | ); | 
| 317 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]); | |
| 317 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, [ 'expected' => $value2 ]); | |
| 318 | 318 | } | 
| 319 | 319 | return $this; | 
| 320 | 320 | } | 
| @@ -329,11 +329,11 @@ discard block | ||
| 329 | 329 | */ | 
| 330 | 330 | public function greaterThan($value2, $message = null, $propertyPath = null) | 
| 331 | 331 |      { | 
| 332 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 332 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 333 | 333 |          { | 
| 334 | 334 | return $this; | 
| 335 | 335 | } | 
| 336 | - if ( ! ( $this->value > $value2 ) ) | |
| 336 | + if ( ! ($this->value > $value2)) | |
| 337 | 337 |          { | 
| 338 | 338 | $message = $message ?: $this->overrideError; | 
| 339 | 339 | $message = sprintf( | 
| @@ -341,7 +341,7 @@ discard block | ||
| 341 | 341 | $this->stringify($this->value), | 
| 342 | 342 | $this->stringify($value2) | 
| 343 | 343 | ); | 
| 344 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]); | |
| 344 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, [ 'expected' => $value2 ]); | |
| 345 | 345 | } | 
| 346 | 346 | return $this; | 
| 347 | 347 | } | 
| @@ -356,11 +356,11 @@ discard block | ||
| 356 | 356 | */ | 
| 357 | 357 | public function greaterThanOrEq($value2, $message = null, $propertyPath = null) | 
| 358 | 358 |      { | 
| 359 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 359 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 360 | 360 |          { | 
| 361 | 361 | return $this; | 
| 362 | 362 | } | 
| 363 | - if ( ! ( $this->value >= $value2 ) ) | |
| 363 | + if ( ! ($this->value >= $value2)) | |
| 364 | 364 |          { | 
| 365 | 365 | $message = $message ?: $this->overrideError; | 
| 366 | 366 | $message = sprintf( | 
| @@ -368,7 +368,7 @@ discard block | ||
| 368 | 368 | $this->stringify($this->value), | 
| 369 | 369 | $this->stringify($value2) | 
| 370 | 370 | ); | 
| 371 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]); | |
| 371 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, [ 'expected' => $value2 ]); | |
| 372 | 372 | } | 
| 373 | 373 | return $this; | 
| 374 | 374 | } | 
| @@ -383,11 +383,11 @@ discard block | ||
| 383 | 383 | */ | 
| 384 | 384 | public function lessThan($value2, $message = null, $propertyPath = null) | 
| 385 | 385 |      { | 
| 386 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 386 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 387 | 387 |          { | 
| 388 | 388 | return $this; | 
| 389 | 389 | } | 
| 390 | - if ( ! ( $this->value < $value2 ) ) | |
| 390 | + if ( ! ($this->value < $value2)) | |
| 391 | 391 |          { | 
| 392 | 392 | $message = $message ?: $this->overrideError; | 
| 393 | 393 | $message = sprintf( | 
| @@ -395,7 +395,7 @@ discard block | ||
| 395 | 395 | $this->stringify($this->value), | 
| 396 | 396 | $this->stringify($value2) | 
| 397 | 397 | ); | 
| 398 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $propertyPath, ['expected' => $value2]); | |
| 398 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $propertyPath, [ 'expected' => $value2 ]); | |
| 399 | 399 | } | 
| 400 | 400 | return $this; | 
| 401 | 401 | } | 
| @@ -410,11 +410,11 @@ discard block | ||
| 410 | 410 | */ | 
| 411 | 411 | public function lessThanOrEq($value2, $message = null, $propertyPath = null) | 
| 412 | 412 |      { | 
| 413 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 413 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 414 | 414 |          { | 
| 415 | 415 | return $this; | 
| 416 | 416 | } | 
| 417 | - if ( ! ( $this->value <= $value2 ) ) | |
| 417 | + if ( ! ($this->value <= $value2)) | |
| 418 | 418 |          { | 
| 419 | 419 | $message = $message ?: $this->overrideError; | 
| 420 | 420 | $message = sprintf( | 
| @@ -422,7 +422,7 @@ discard block | ||
| 422 | 422 | $this->stringify($this->value), | 
| 423 | 423 | $this->stringify($value2) | 
| 424 | 424 | ); | 
| 425 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $propertyPath, ['expected' => $value2]); | |
| 425 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $propertyPath, [ 'expected' => $value2 ]); | |
| 426 | 426 | } | 
| 427 | 427 | return $this; | 
| 428 | 428 | } | 
| @@ -438,11 +438,11 @@ discard block | ||
| 438 | 438 | */ | 
| 439 | 439 | public function same($value2, $message = null, $propertyPath = null) | 
| 440 | 440 |      { | 
| 441 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 441 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 442 | 442 |          { | 
| 443 | 443 | return $this; | 
| 444 | 444 | } | 
| 445 | - if ( $this->value !== $value2 ) | |
| 445 | + if ($this->value !== $value2) | |
| 446 | 446 |          { | 
| 447 | 447 | $message = $message ?: $this->overrideError; | 
| 448 | 448 | $message = sprintf( | 
| @@ -450,7 +450,7 @@ discard block | ||
| 450 | 450 | $this->stringify($this->value), | 
| 451 | 451 | $this->stringify($value2) | 
| 452 | 452 | ); | 
| 453 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $propertyPath, ['expected' => $value2]); | |
| 453 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $propertyPath, [ 'expected' => $value2 ]); | |
| 454 | 454 | } | 
| 455 | 455 | return $this; | 
| 456 | 456 | } | 
| @@ -466,11 +466,11 @@ discard block | ||
| 466 | 466 | */ | 
| 467 | 467 | public function notEq($value2, $message = null, $propertyPath = null) | 
| 468 | 468 |      { | 
| 469 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 469 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 470 | 470 |          { | 
| 471 | 471 | return $this; | 
| 472 | 472 | } | 
| 473 | - if ( $this->value == $value2 ) | |
| 473 | + if ($this->value == $value2) | |
| 474 | 474 |          { | 
| 475 | 475 | $message = $message ?: $this->overrideError; | 
| 476 | 476 | $message = sprintf( | 
| @@ -478,7 +478,7 @@ discard block | ||
| 478 | 478 | $this->stringify($this->value), | 
| 479 | 479 | $this->stringify($value2) | 
| 480 | 480 | ); | 
| 481 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $propertyPath, ['expected' => $value2]); | |
| 481 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $propertyPath, [ 'expected' => $value2 ]); | |
| 482 | 482 | } | 
| 483 | 483 | return $this; | 
| 484 | 484 | } | 
| @@ -492,11 +492,11 @@ discard block | ||
| 492 | 492 | */ | 
| 493 | 493 | public function isCallable($message = null, $propertyPath = null) | 
| 494 | 494 |      { | 
| 495 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 495 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 496 | 496 |          { | 
| 497 | 497 | return $this; | 
| 498 | 498 | } | 
| 499 | - if ( !is_callable($this->value) ) | |
| 499 | + if ( ! is_callable($this->value)) | |
| 500 | 500 |          { | 
| 501 | 501 | $message = $message ?: $this->overrideError; | 
| 502 | 502 | $message = sprintf( | 
| @@ -519,11 +519,11 @@ discard block | ||
| 519 | 519 | */ | 
| 520 | 520 | public function notSame($value2, $message = null, $propertyPath = 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_SAME, $propertyPath, ['expected' => $value2]); | |
| 534 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $propertyPath, [ 'expected' => $value2 ]); | |
| 535 | 535 | } | 
| 536 | 536 | return $this; | 
| 537 | 537 | } | 
| @@ -555,7 +555,7 @@ discard block | ||
| 555 | 555 | * @return Assert | 
| 556 | 556 | * @throws AssertionFailedException | 
| 557 | 557 | */ | 
| 558 | - public function unsignedInt($message=null, $propertyPath=null) | |
| 558 | + public function unsignedInt($message = null, $propertyPath = null) | |
| 559 | 559 |      { | 
| 560 | 560 | $message = $message ?: $this->overrideError; | 
| 561 | 561 | $message = $message ?: 'Value "%s" is not an integer id.'; | 
| @@ -586,7 +586,7 @@ discard block | ||
| 586 | 586 |      { | 
| 587 | 587 | $message = $message ?: $this->overrideError; | 
| 588 | 588 | $message = $message ?: 'Value "%s" is not a valid status.'; | 
| 589 | - return $this->integer($message, $propertyPath)->inArray([-1, 0, 1]); | |
| 589 | + return $this->integer($message, $propertyPath)->inArray([-1, 0, 1 ]); | |
| 590 | 590 | } | 
| 591 | 591 | |
| 592 | 592 | /** | 
| @@ -630,11 +630,11 @@ discard block | ||
| 630 | 630 | */ | 
| 631 | 631 | public function integer($message = null, $propertyPath = null) | 
| 632 | 632 |      { | 
| 633 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 633 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 634 | 634 |          { | 
| 635 | 635 | return $this; | 
| 636 | 636 | } | 
| 637 | - if ( !is_int($this->value) ) | |
| 637 | + if ( ! is_int($this->value)) | |
| 638 | 638 |          { | 
| 639 | 639 | $message = $message ?: $this->overrideError; | 
| 640 | 640 | $message = sprintf( | 
| @@ -656,11 +656,11 @@ discard block | ||
| 656 | 656 | */ | 
| 657 | 657 | public function float($message = null, $propertyPath = null) | 
| 658 | 658 |      { | 
| 659 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 659 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 660 | 660 |          { | 
| 661 | 661 | return $this; | 
| 662 | 662 | } | 
| 663 | - if ( ! is_float($this->value) ) | |
| 663 | + if ( ! is_float($this->value)) | |
| 664 | 664 |          { | 
| 665 | 665 | $message = $message ?: $this->overrideError; | 
| 666 | 666 | $message = sprintf( | 
| @@ -682,11 +682,11 @@ discard block | ||
| 682 | 682 | */ | 
| 683 | 683 | public function digit($message = null, $propertyPath = null) | 
| 684 | 684 |      { | 
| 685 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 685 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 686 | 686 |          { | 
| 687 | 687 | return $this; | 
| 688 | 688 | } | 
| 689 | - if ( ! ctype_digit((string)$this->value) ) | |
| 689 | + if ( ! ctype_digit((string)$this->value)) | |
| 690 | 690 |          { | 
| 691 | 691 | $message = $message ?: $this->overrideError; | 
| 692 | 692 | $message = sprintf( | 
| @@ -708,12 +708,12 @@ discard block | ||
| 708 | 708 | */ | 
| 709 | 709 | public function date($message = null, $propertyPath = null) | 
| 710 | 710 |      { | 
| 711 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 711 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 712 | 712 |          { | 
| 713 | 713 | return $this; | 
| 714 | 714 | } | 
| 715 | 715 | $this->notEmpty($message, $propertyPath); | 
| 716 | - if ( strtotime($this->value) === false ) | |
| 716 | + if (strtotime($this->value) === false) | |
| 717 | 717 |          { | 
| 718 | 718 | $message = $message ?: $this->overrideError; | 
| 719 | 719 | $message = sprintf( | 
| @@ -735,11 +735,11 @@ discard block | ||
| 735 | 735 | */ | 
| 736 | 736 | public function integerish($message = null, $propertyPath = null) | 
| 737 | 737 |      { | 
| 738 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 738 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 739 | 739 |          { | 
| 740 | 740 | return $this; | 
| 741 | 741 | } | 
| 742 | - if ( is_object($this->value) || strval(intval($this->value)) != $this->value || is_bool($this->value) || is_null($this->value) ) | |
| 742 | + if (is_object($this->value) || strval(intval($this->value)) != $this->value || is_bool($this->value) || is_null($this->value)) | |
| 743 | 743 |          { | 
| 744 | 744 | $message = $message ?: $this->overrideError; | 
| 745 | 745 | $message = sprintf( | 
| @@ -761,11 +761,11 @@ discard block | ||
| 761 | 761 | */ | 
| 762 | 762 | public function boolean($message = null, $propertyPath = null) | 
| 763 | 763 |      { | 
| 764 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 764 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 765 | 765 |          { | 
| 766 | 766 | return $this; | 
| 767 | 767 | } | 
| 768 | - if ( ! is_bool($this->value) ) | |
| 768 | + if ( ! is_bool($this->value)) | |
| 769 | 769 |          { | 
| 770 | 770 | $message = $message ?: $this->overrideError; | 
| 771 | 771 | $message = sprintf( | 
| @@ -787,11 +787,11 @@ discard block | ||
| 787 | 787 | */ | 
| 788 | 788 | public function scalar($message = null, $propertyPath = null) | 
| 789 | 789 |      { | 
| 790 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 790 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 791 | 791 |          { | 
| 792 | 792 | return $this; | 
| 793 | 793 | } | 
| 794 | - if ( ! is_scalar($this->value) ) | |
| 794 | + if ( ! is_scalar($this->value)) | |
| 795 | 795 |          { | 
| 796 | 796 | $message = $message ?: $this->overrideError; | 
| 797 | 797 | $message = sprintf( | 
| @@ -813,11 +813,11 @@ discard block | ||
| 813 | 813 | */ | 
| 814 | 814 | public function notEmpty($message = null, $propertyPath = null) | 
| 815 | 815 |      { | 
| 816 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 816 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 817 | 817 |          { | 
| 818 | 818 | return $this; | 
| 819 | 819 | } | 
| 820 | - if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) ) | |
| 820 | + if ((is_object($this->value) && empty((array)$this->value)) || empty($this->value)) | |
| 821 | 821 |          { | 
| 822 | 822 | $message = $message ?: $this->overrideError; | 
| 823 | 823 | $message = sprintf( | 
| @@ -839,11 +839,11 @@ discard block | ||
| 839 | 839 | */ | 
| 840 | 840 | public function noContent($message = null, $propertyPath = null) | 
| 841 | 841 |      { | 
| 842 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 842 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 843 | 843 |          { | 
| 844 | 844 | return $this; | 
| 845 | 845 | } | 
| 846 | - if ( !empty( $this->value ) ) | |
| 846 | + if ( ! empty($this->value)) | |
| 847 | 847 |          { | 
| 848 | 848 | $message = $message ?: $this->overrideError; | 
| 849 | 849 | $message = sprintf( | 
| @@ -865,11 +865,11 @@ discard block | ||
| 865 | 865 | */ | 
| 866 | 866 | public function notNull($message = null, $propertyPath = null) | 
| 867 | 867 |      { | 
| 868 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 868 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 869 | 869 |          { | 
| 870 | 870 | return $this; | 
| 871 | 871 | } | 
| 872 | - if ( $this->value === null ) | |
| 872 | + if ($this->value === null) | |
| 873 | 873 |          { | 
| 874 | 874 | $message = $message ?: $this->overrideError; | 
| 875 | 875 | $message = sprintf( | 
| @@ -891,11 +891,11 @@ discard block | ||
| 891 | 891 | */ | 
| 892 | 892 | public function string($message = null, $propertyPath = null) | 
| 893 | 893 |      { | 
| 894 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 894 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 895 | 895 |          { | 
| 896 | 896 | return $this; | 
| 897 | 897 | } | 
| 898 | - if ( !is_string($this->value) ) | |
| 898 | + if ( ! is_string($this->value)) | |
| 899 | 899 |          { | 
| 900 | 900 | $message = $message ?: $this->overrideError; | 
| 901 | 901 | $message = sprintf( | 
| @@ -917,21 +917,21 @@ discard block | ||
| 917 | 917 | * @return Assert | 
| 918 | 918 | * @throws AssertionFailedException | 
| 919 | 919 | */ | 
| 920 | - public function regex($pattern, $message=null, $propertyPath=null) | |
| 920 | + public function regex($pattern, $message = null, $propertyPath = null) | |
| 921 | 921 |      { | 
| 922 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 922 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 923 | 923 |          { | 
| 924 | 924 | return $this; | 
| 925 | 925 | } | 
| 926 | 926 | $this->string($message, $propertyPath); | 
| 927 | - if ( ! preg_match($pattern, $this->value) ) | |
| 927 | + if ( ! preg_match($pattern, $this->value)) | |
| 928 | 928 |          { | 
| 929 | 929 | $message = $message ?: $this->overrideError; | 
| 930 | 930 | $message = sprintf( | 
| 931 | 931 | $message ?: 'Value "%s" does not match expression.', | 
| 932 | 932 | $this->stringify($this->value) | 
| 933 | 933 | ); | 
| 934 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]); | |
| 934 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, [ 'pattern' => $pattern ]); | |
| 935 | 935 | } | 
| 936 | 936 | return $this; | 
| 937 | 937 | } | 
| @@ -944,13 +944,13 @@ discard block | ||
| 944 | 944 | */ | 
| 945 | 945 | public function ipAddress($message = null, $propertyPath = null) | 
| 946 | 946 |      { | 
| 947 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 947 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 948 | 948 |          { | 
| 949 | 949 | return $this; | 
| 950 | 950 | } | 
| 951 | 951 | $this->string($message, $propertyPath); | 
| 952 | -        $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])$/'; | |
| 953 | - if ( ! preg_match($pattern, $this->value) ) | |
| 952 | +        $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])$/'; | |
| 953 | + if ( ! preg_match($pattern, $this->value)) | |
| 954 | 954 |          { | 
| 955 | 955 | $message = $message ?: $this->overrideError; | 
| 956 | 956 | $message = sprintf( | 
| @@ -971,19 +971,19 @@ discard block | ||
| 971 | 971 | */ | 
| 972 | 972 | public function notRegex($pattern, $message = null, $propertyPath = null) | 
| 973 | 973 |      { | 
| 974 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 974 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 975 | 975 |          { | 
| 976 | 976 | return $this; | 
| 977 | 977 | } | 
| 978 | 978 | $this->string($message, $propertyPath); | 
| 979 | - if ( preg_match($pattern, $this->value) ) | |
| 979 | + if (preg_match($pattern, $this->value)) | |
| 980 | 980 |          { | 
| 981 | 981 | $message = $message ?: $this->overrideError; | 
| 982 | 982 | $message = sprintf( | 
| 983 | 983 | $message ?: 'Value "%s" does not match expression.', | 
| 984 | 984 | $this->stringify($this->value) | 
| 985 | 985 | ); | 
| 986 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]); | |
| 986 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, [ 'pattern' => $pattern ]); | |
| 987 | 987 | } | 
| 988 | 988 | return $this; | 
| 989 | 989 | } | 
| @@ -1000,12 +1000,12 @@ discard block | ||
| 1000 | 1000 | */ | 
| 1001 | 1001 | public function length($length, $message = null, $propertyPath = null, $encoding = 'utf8') | 
| 1002 | 1002 |      { | 
| 1003 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1003 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1004 | 1004 |          { | 
| 1005 | 1005 | return $this; | 
| 1006 | 1006 | } | 
| 1007 | 1007 | $this->string($message, $propertyPath); | 
| 1008 | - if ( mb_strlen($this->value, $encoding) !== $length ) | |
| 1008 | + if (mb_strlen($this->value, $encoding) !== $length) | |
| 1009 | 1009 |          { | 
| 1010 | 1010 | $message = $message ?: $this->overrideError; | 
| 1011 | 1011 | $message = sprintf( | 
| @@ -1014,7 +1014,7 @@ discard block | ||
| 1014 | 1014 | $length, | 
| 1015 | 1015 | mb_strlen($this->value, $encoding) | 
| 1016 | 1016 | ); | 
| 1017 | - $constraints = ['length' => $length, 'encoding' => $encoding]; | |
| 1017 | + $constraints = [ 'length' => $length, 'encoding' => $encoding ]; | |
| 1018 | 1018 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_LENGTH, $propertyPath, $constraints); | 
| 1019 | 1019 | } | 
| 1020 | 1020 | return $this; | 
| @@ -1032,22 +1032,22 @@ discard block | ||
| 1032 | 1032 | */ | 
| 1033 | 1033 | public function minLength($minLength, $message = null, $propertyPath = null, $encoding = 'utf8') | 
| 1034 | 1034 |      { | 
| 1035 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1035 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1036 | 1036 |          { | 
| 1037 | 1037 | return $this; | 
| 1038 | 1038 | } | 
| 1039 | 1039 | $this->string($message, $propertyPath); | 
| 1040 | - if ( mb_strlen($this->value, $encoding) < $minLength ) | |
| 1040 | + if (mb_strlen($this->value, $encoding) < $minLength) | |
| 1041 | 1041 |          { | 
| 1042 | 1042 | $message = $message ?: $this->overrideError; | 
| 1043 | - $message = sprintf( | |
| 1043 | + $message = sprintf( | |
| 1044 | 1044 | $message | 
| 1045 | 1045 | ?: 'Value "%s" is too short, it should have more than %d characters, but only has %d characters.', | 
| 1046 | 1046 | $this->stringify($this->value), | 
| 1047 | 1047 | $minLength, | 
| 1048 | 1048 | mb_strlen($this->value, $encoding) | 
| 1049 | 1049 | ); | 
| 1050 | - $constraints = ['min_length' => $minLength, 'encoding' => $encoding]; | |
| 1050 | + $constraints = [ 'min_length' => $minLength, 'encoding' => $encoding ]; | |
| 1051 | 1051 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN_LENGTH, $propertyPath, $constraints); | 
| 1052 | 1052 | } | 
| 1053 | 1053 | return $this; | 
| @@ -1065,21 +1065,21 @@ discard block | ||
| 1065 | 1065 | */ | 
| 1066 | 1066 | public function maxLength($maxLength, $message = null, $propertyPath = null, $encoding = 'utf8') | 
| 1067 | 1067 |      { | 
| 1068 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1068 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1069 | 1069 |          { | 
| 1070 | 1070 | return $this; | 
| 1071 | 1071 | } | 
| 1072 | 1072 | $this->string($message, $propertyPath); | 
| 1073 | - if ( mb_strlen($this->value, $encoding) > $maxLength ) | |
| 1073 | + if (mb_strlen($this->value, $encoding) > $maxLength) | |
| 1074 | 1074 |          { | 
| 1075 | 1075 | $message = $message ?: $this->overrideError; | 
| 1076 | - $message = sprintf( | |
| 1076 | + $message = sprintf( | |
| 1077 | 1077 | $message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.', | 
| 1078 | 1078 | $this->stringify($this->value), | 
| 1079 | 1079 | $maxLength, | 
| 1080 | 1080 | mb_strlen($this->value, $encoding) | 
| 1081 | 1081 | ); | 
| 1082 | - $constraints = ['max_length' => $maxLength, 'encoding' => $encoding]; | |
| 1082 | + $constraints = [ 'max_length' => $maxLength, 'encoding' => $encoding ]; | |
| 1083 | 1083 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX_LENGTH, $propertyPath, $constraints); | 
| 1084 | 1084 | } | 
| 1085 | 1085 | return $this; | 
| @@ -1098,34 +1098,34 @@ discard block | ||
| 1098 | 1098 | */ | 
| 1099 | 1099 | public function betweenLength($minLength, $maxLength, $message = null, $propertyPath = null, $encoding = 'utf8') | 
| 1100 | 1100 |      { | 
| 1101 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1101 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1102 | 1102 |          { | 
| 1103 | 1103 | return $this; | 
| 1104 | 1104 | } | 
| 1105 | 1105 | $this->string($message, $propertyPath); | 
| 1106 | - if ( mb_strlen($this->value, $encoding) < $minLength ) | |
| 1106 | + if (mb_strlen($this->value, $encoding) < $minLength) | |
| 1107 | 1107 |          { | 
| 1108 | 1108 | $message = $message ?: $this->overrideError; | 
| 1109 | - $message = sprintf( | |
| 1109 | + $message = sprintf( | |
| 1110 | 1110 | $message | 
| 1111 | 1111 | ?: 'Value "%s" is too short, it should have more than %d characters, but only has %d characters.', | 
| 1112 | 1112 | $this->stringify($this->value), | 
| 1113 | 1113 | $minLength, | 
| 1114 | 1114 | mb_strlen($this->value, $encoding) | 
| 1115 | 1115 | ); | 
| 1116 | - $constraints = ['min_length' => $minLength, 'encoding' => $encoding]; | |
| 1116 | + $constraints = [ 'min_length' => $minLength, 'encoding' => $encoding ]; | |
| 1117 | 1117 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN_LENGTH, $propertyPath, $constraints); | 
| 1118 | 1118 | } | 
| 1119 | - if ( mb_strlen($this->value, $encoding) > $maxLength ) | |
| 1119 | + if (mb_strlen($this->value, $encoding) > $maxLength) | |
| 1120 | 1120 |          { | 
| 1121 | 1121 | $message = $message ?: $this->overrideError; | 
| 1122 | - $message = sprintf( | |
| 1122 | + $message = sprintf( | |
| 1123 | 1123 | $message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.', | 
| 1124 | 1124 | $this->stringify($this->value), | 
| 1125 | 1125 | $maxLength, | 
| 1126 | 1126 | mb_strlen($this->value, $encoding) | 
| 1127 | 1127 | ); | 
| 1128 | - $constraints = ['max_length' => $maxLength, 'encoding' => $encoding]; | |
| 1128 | + $constraints = [ 'max_length' => $maxLength, 'encoding' => $encoding ]; | |
| 1129 | 1129 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX_LENGTH, $propertyPath, $constraints); | 
| 1130 | 1130 | } | 
| 1131 | 1131 | return $this; | 
| @@ -1143,20 +1143,20 @@ discard block | ||
| 1143 | 1143 | */ | 
| 1144 | 1144 | public function startsWith($needle, $message = null, $propertyPath = null, $encoding = 'utf8') | 
| 1145 | 1145 |      { | 
| 1146 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1146 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1147 | 1147 |          { | 
| 1148 | 1148 | return $this; | 
| 1149 | 1149 | } | 
| 1150 | 1150 | $this->string($message, $propertyPath); | 
| 1151 | - if ( mb_strpos($this->value, $needle, null, $encoding) !== 0 ) | |
| 1151 | + if (mb_strpos($this->value, $needle, null, $encoding) !== 0) | |
| 1152 | 1152 |          { | 
| 1153 | 1153 | $message = $message ?: $this->overrideError; | 
| 1154 | - $message = sprintf( | |
| 1154 | + $message = sprintf( | |
| 1155 | 1155 | $message ?: 'Value "%s" does not start with "%s".', | 
| 1156 | 1156 | $this->stringify($this->value), | 
| 1157 | 1157 | $this->stringify($needle) | 
| 1158 | 1158 | ); | 
| 1159 | - $constraints = ['needle' => $needle, 'encoding' => $encoding]; | |
| 1159 | + $constraints = [ 'needle' => $needle, 'encoding' => $encoding ]; | |
| 1160 | 1160 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_START, $propertyPath, $constraints); | 
| 1161 | 1161 | } | 
| 1162 | 1162 | return $this; | 
| @@ -1174,21 +1174,21 @@ discard block | ||
| 1174 | 1174 | */ | 
| 1175 | 1175 | public function endsWith($needle, $message = null, $propertyPath = null, $encoding = 'utf8') | 
| 1176 | 1176 |      { | 
| 1177 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1177 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1178 | 1178 |          { | 
| 1179 | 1179 | return $this; | 
| 1180 | 1180 | } | 
| 1181 | 1181 | $this->string($message, $propertyPath); | 
| 1182 | 1182 | $stringPosition = mb_strlen($this->value, $encoding) - mb_strlen($needle, $encoding); | 
| 1183 | - if ( mb_strripos($this->value, $needle, null, $encoding) !== $stringPosition ) | |
| 1183 | + if (mb_strripos($this->value, $needle, null, $encoding) !== $stringPosition) | |
| 1184 | 1184 |          { | 
| 1185 | 1185 | $message = $message ?: $this->overrideError; | 
| 1186 | - $message = sprintf( | |
| 1186 | + $message = sprintf( | |
| 1187 | 1187 | $message ?: 'Value "%s" does not end with "%s".', | 
| 1188 | 1188 | $this->stringify($this->value), | 
| 1189 | 1189 | $this->stringify($needle) | 
| 1190 | 1190 | ); | 
| 1191 | - $constraints = ['needle' => $needle, 'encoding' => $encoding]; | |
| 1191 | + $constraints = [ 'needle' => $needle, 'encoding' => $encoding ]; | |
| 1192 | 1192 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_END, $propertyPath, $constraints); | 
| 1193 | 1193 | } | 
| 1194 | 1194 | return $this; | 
| @@ -1206,20 +1206,20 @@ discard block | ||
| 1206 | 1206 | */ | 
| 1207 | 1207 | public function contains($needle, $message = null, $propertyPath = null, $encoding = 'utf8') | 
| 1208 | 1208 |      { | 
| 1209 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1209 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1210 | 1210 |          { | 
| 1211 | 1211 | return $this; | 
| 1212 | 1212 | } | 
| 1213 | 1213 | $this->string($message, $propertyPath); | 
| 1214 | - if ( mb_strpos($this->value, $needle, null, $encoding) === false ) | |
| 1214 | + if (mb_strpos($this->value, $needle, null, $encoding) === false) | |
| 1215 | 1215 |          { | 
| 1216 | 1216 | $message = $message ?: $this->overrideError; | 
| 1217 | - $message = sprintf( | |
| 1217 | + $message = sprintf( | |
| 1218 | 1218 | $message ?: 'Value "%s" does not contain "%s".', | 
| 1219 | 1219 | $this->stringify($this->value), | 
| 1220 | 1220 | $this->stringify($needle) | 
| 1221 | 1221 | ); | 
| 1222 | - $constraints = ['needle' => $needle, 'encoding' => $encoding]; | |
| 1222 | + $constraints = [ 'needle' => $needle, 'encoding' => $encoding ]; | |
| 1223 | 1223 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_CONTAINS, $propertyPath, $constraints); | 
| 1224 | 1224 | } | 
| 1225 | 1225 | return $this; | 
| @@ -1236,11 +1236,11 @@ discard block | ||
| 1236 | 1236 | */ | 
| 1237 | 1237 | public function choice(array $choices, $message = null, $propertyPath = null) | 
| 1238 | 1238 |      { | 
| 1239 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1239 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1240 | 1240 |          { | 
| 1241 | 1241 | return $this; | 
| 1242 | 1242 | } | 
| 1243 | - if ( !in_array($this->value, $choices, true) ) | |
| 1243 | + if ( ! in_array($this->value, $choices, true)) | |
| 1244 | 1244 |          { | 
| 1245 | 1245 | $message = $message ?: $this->overrideError; | 
| 1246 | 1246 | $message = sprintf( | 
| @@ -1248,7 +1248,7 @@ discard block | ||
| 1248 | 1248 | $this->stringify($this->value), | 
| 1249 | 1249 |                  implode(", ", array_map('Terah\Assert\Assert::stringify', $choices)) | 
| 1250 | 1250 | ); | 
| 1251 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_CHOICE, $propertyPath, ['choices' => $choices]); | |
| 1251 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_CHOICE, $propertyPath, [ 'choices' => $choices ]); | |
| 1252 | 1252 | } | 
| 1253 | 1253 | return $this; | 
| 1254 | 1254 | } | 
| @@ -1265,7 +1265,7 @@ discard block | ||
| 1265 | 1265 | */ | 
| 1266 | 1266 | public function inArray(array $choices, $message = null, $propertyPath = null) | 
| 1267 | 1267 |      { | 
| 1268 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1268 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1269 | 1269 |          { | 
| 1270 | 1270 | return $this; | 
| 1271 | 1271 | } | 
| @@ -1283,11 +1283,11 @@ discard block | ||
| 1283 | 1283 | */ | 
| 1284 | 1284 | public function numeric($message = null, $propertyPath = null) | 
| 1285 | 1285 |      { | 
| 1286 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1286 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1287 | 1287 |          { | 
| 1288 | 1288 | return $this; | 
| 1289 | 1289 | } | 
| 1290 | - if ( ! is_numeric($this->value) ) | |
| 1290 | + if ( ! is_numeric($this->value)) | |
| 1291 | 1291 |          { | 
| 1292 | 1292 | $message = $message ?: $this->overrideError; | 
| 1293 | 1293 | $message = sprintf( | 
| @@ -1345,11 +1345,11 @@ discard block | ||
| 1345 | 1345 | */ | 
| 1346 | 1346 | public function isArray($message = null, $propertyPath = null) | 
| 1347 | 1347 |      { | 
| 1348 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1348 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1349 | 1349 |          { | 
| 1350 | 1350 | return $this; | 
| 1351 | 1351 | } | 
| 1352 | - if ( !is_array($this->value) ) | |
| 1352 | + if ( ! is_array($this->value)) | |
| 1353 | 1353 |          { | 
| 1354 | 1354 | $message = $message ?: $this->overrideError; | 
| 1355 | 1355 | $message = sprintf( | 
| @@ -1371,11 +1371,11 @@ discard block | ||
| 1371 | 1371 | */ | 
| 1372 | 1372 | public function isTraversable($message = null, $propertyPath = null) | 
| 1373 | 1373 |      { | 
| 1374 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1374 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1375 | 1375 |          { | 
| 1376 | 1376 | return $this; | 
| 1377 | 1377 | } | 
| 1378 | - if ( !is_array($this->value) && !$this->value instanceof \Traversable ) | |
| 1378 | + if ( ! is_array($this->value) && ! $this->value instanceof \Traversable) | |
| 1379 | 1379 |          { | 
| 1380 | 1380 | $message = $message ?: $this->overrideError; | 
| 1381 | 1381 | $message = sprintf( | 
| @@ -1397,11 +1397,11 @@ discard block | ||
| 1397 | 1397 | */ | 
| 1398 | 1398 | public function isArrayAccessible($message = null, $propertyPath = null) | 
| 1399 | 1399 |      { | 
| 1400 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1400 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1401 | 1401 |          { | 
| 1402 | 1402 | return $this; | 
| 1403 | 1403 | } | 
| 1404 | - if ( !is_array($this->value) && !$this->value instanceof \ArrayAccess ) | |
| 1404 | + if ( ! is_array($this->value) && ! $this->value instanceof \ArrayAccess) | |
| 1405 | 1405 |          { | 
| 1406 | 1406 | $message = $message ?: $this->overrideError; | 
| 1407 | 1407 | $message = sprintf( | 
| @@ -1424,19 +1424,19 @@ discard block | ||
| 1424 | 1424 | */ | 
| 1425 | 1425 | public function keyExists($key, $message = null, $propertyPath = null) | 
| 1426 | 1426 |      { | 
| 1427 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1427 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1428 | 1428 |          { | 
| 1429 | 1429 | return $this; | 
| 1430 | 1430 | } | 
| 1431 | 1431 | $this->isArray($message, $propertyPath); | 
| 1432 | - if ( !array_key_exists($key, $this->value) ) | |
| 1432 | + if ( ! array_key_exists($key, $this->value)) | |
| 1433 | 1433 |          { | 
| 1434 | 1434 | $message = $message ?: $this->overrideError; | 
| 1435 | 1435 | $message = sprintf( | 
| 1436 | 1436 | $message ?: 'Array does not contain an element with key "%s"', | 
| 1437 | 1437 | $this->stringify($key) | 
| 1438 | 1438 | ); | 
| 1439 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_EXISTS, $propertyPath, ['key' => $key]); | |
| 1439 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_EXISTS, $propertyPath, [ 'key' => $key ]); | |
| 1440 | 1440 | } | 
| 1441 | 1441 | return $this; | 
| 1442 | 1442 | } | 
| @@ -1452,21 +1452,21 @@ discard block | ||
| 1452 | 1452 | */ | 
| 1453 | 1453 | public function keysExist($keys, $message = null, $propertyPath = null) | 
| 1454 | 1454 |      { | 
| 1455 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1455 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1456 | 1456 |          { | 
| 1457 | 1457 | return $this; | 
| 1458 | 1458 | } | 
| 1459 | 1459 | $this->isArray($message, $propertyPath); | 
| 1460 | - foreach ( $keys as $key ) | |
| 1460 | + foreach ($keys as $key) | |
| 1461 | 1461 |          { | 
| 1462 | - if ( !array_key_exists($key, $this->value) ) | |
| 1462 | + if ( ! array_key_exists($key, $this->value)) | |
| 1463 | 1463 |              { | 
| 1464 | 1464 | $message = $message | 
| 1465 | 1465 | ?: sprintf( | 
| 1466 | 1466 | 'Array does not contain an element with key "%s"', | 
| 1467 | 1467 | $this->stringify($key) | 
| 1468 | 1468 | ); | 
| 1469 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEYS_EXIST, $propertyPath, ['key' => $key]); | |
| 1469 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEYS_EXIST, $propertyPath, [ 'key' => $key ]); | |
| 1470 | 1470 | } | 
| 1471 | 1471 | } | 
| 1472 | 1472 | return $this; | 
| @@ -1483,19 +1483,19 @@ discard block | ||
| 1483 | 1483 | */ | 
| 1484 | 1484 | public function propertyExists($key, $message = null, $propertyPath = null) | 
| 1485 | 1485 |      { | 
| 1486 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1486 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1487 | 1487 |          { | 
| 1488 | 1488 | return $this; | 
| 1489 | 1489 | } | 
| 1490 | 1490 | $this->isObject($message, $propertyPath); | 
| 1491 | -        if ( !property_exists($this->value, $key) && !isset( $this->value->{$key} ) ) | |
| 1491 | +        if ( ! property_exists($this->value, $key) && ! isset($this->value->{$key} )) | |
| 1492 | 1492 |          { | 
| 1493 | 1493 | $message = $message | 
| 1494 | 1494 | ?: sprintf( | 
| 1495 | 1495 | 'Object does not contain a property with key "%s"', | 
| 1496 | 1496 | $this->stringify($key) | 
| 1497 | 1497 | ); | 
| 1498 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTY_EXISTS, $propertyPath, ['key' => $key]); | |
| 1498 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTY_EXISTS, $propertyPath, [ 'key' => $key ]); | |
| 1499 | 1499 | } | 
| 1500 | 1500 | return $this; | 
| 1501 | 1501 | } | 
| @@ -1511,22 +1511,22 @@ discard block | ||
| 1511 | 1511 | */ | 
| 1512 | 1512 | public function propertiesExist(array $keys, $message = null, $propertyPath = null) | 
| 1513 | 1513 |      { | 
| 1514 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1514 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1515 | 1515 |          { | 
| 1516 | 1516 | return $this; | 
| 1517 | 1517 | } | 
| 1518 | 1518 | $this->isObject($message, $propertyPath); | 
| 1519 | - foreach ( $keys as $key ) | |
| 1519 | + foreach ($keys as $key) | |
| 1520 | 1520 |          { | 
| 1521 | 1521 | // Using isset to allow resolution of magically defined properties | 
| 1522 | -            if ( !property_exists($this->value, $key) && !isset( $this->value->{$key} ) ) | |
| 1522 | +            if ( ! property_exists($this->value, $key) && ! isset($this->value->{$key} )) | |
| 1523 | 1523 |              { | 
| 1524 | 1524 | $message = $message | 
| 1525 | 1525 | ?: sprintf( | 
| 1526 | 1526 | 'Object does not contain a property with key "%s"', | 
| 1527 | 1527 | $this->stringify($key) | 
| 1528 | 1528 | ); | 
| 1529 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTIES_EXIST, $propertyPath, ['key' => $key]); | |
| 1529 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTIES_EXIST, $propertyPath, [ 'key' => $key ]); | |
| 1530 | 1530 | } | 
| 1531 | 1531 | } | 
| 1532 | 1532 | return $this; | 
| @@ -1542,12 +1542,12 @@ discard block | ||
| 1542 | 1542 | */ | 
| 1543 | 1543 | public function utf8($message = null, $propertyPath = null) | 
| 1544 | 1544 |      { | 
| 1545 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1545 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1546 | 1546 |          { | 
| 1547 | 1547 | return $this; | 
| 1548 | 1548 | } | 
| 1549 | 1549 | $this->string($message, $propertyPath); | 
| 1550 | - if ( mb_detect_encoding($this->value, 'UTF-8', true) !== 'UTF-8' ) | |
| 1550 | + if (mb_detect_encoding($this->value, 'UTF-8', true) !== 'UTF-8') | |
| 1551 | 1551 |          { | 
| 1552 | 1552 | $message = $message | 
| 1553 | 1553 | ?: sprintf( | 
| @@ -1570,12 +1570,12 @@ discard block | ||
| 1570 | 1570 | */ | 
| 1571 | 1571 | public function ascii($message = null, $propertyPath = null) | 
| 1572 | 1572 |      { | 
| 1573 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1573 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1574 | 1574 |          { | 
| 1575 | 1575 | return $this; | 
| 1576 | 1576 | } | 
| 1577 | 1577 | $this->string($message, $propertyPath); | 
| 1578 | -        if ( ! preg_match('/^[ -~]+$/', $this->value) ) | |
| 1578 | +        if ( ! preg_match('/^[ -~]+$/', $this->value)) | |
| 1579 | 1579 |          { | 
| 1580 | 1580 | $message = $message | 
| 1581 | 1581 | ?: sprintf( | 
| @@ -1598,19 +1598,19 @@ discard block | ||
| 1598 | 1598 | */ | 
| 1599 | 1599 | public function keyIsset($key, $message = null, $propertyPath = null) | 
| 1600 | 1600 |      { | 
| 1601 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1601 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1602 | 1602 |          { | 
| 1603 | 1603 | return $this; | 
| 1604 | 1604 | } | 
| 1605 | 1605 | $this->isArrayAccessible($message, $propertyPath); | 
| 1606 | - if ( !isset( $this->value[$key] ) ) | |
| 1606 | + if ( ! isset($this->value[ $key ])) | |
| 1607 | 1607 |          { | 
| 1608 | 1608 | $message = $message ?: $this->overrideError; | 
| 1609 | 1609 | $message = sprintf( | 
| 1610 | 1610 | $message ?: 'The element with key "%s" was not found', | 
| 1611 | 1611 | $this->stringify($key) | 
| 1612 | 1612 | ); | 
| 1613 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_ISSET, $propertyPath, ['key' => $key]); | |
| 1613 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_ISSET, $propertyPath, [ 'key' => $key ]); | |
| 1614 | 1614 | } | 
| 1615 | 1615 | return $this; | 
| 1616 | 1616 | } | 
| @@ -1626,12 +1626,12 @@ discard block | ||
| 1626 | 1626 | */ | 
| 1627 | 1627 | public function notEmptyKey($key, $message = null, $propertyPath = null) | 
| 1628 | 1628 |      { | 
| 1629 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1629 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1630 | 1630 |          { | 
| 1631 | 1631 | return $this; | 
| 1632 | 1632 | } | 
| 1633 | 1633 | $this->keyIsset($key, $message, $propertyPath); | 
| 1634 | - (new Assert($this->value[$key]))->setExceptionClass($this->exceptionClass)->notEmpty($message, $propertyPath); | |
| 1634 | + (new Assert($this->value[ $key ]))->setExceptionClass($this->exceptionClass)->notEmpty($message, $propertyPath); | |
| 1635 | 1635 | return $this; | 
| 1636 | 1636 | } | 
| 1637 | 1637 | |
| @@ -1645,11 +1645,11 @@ discard block | ||
| 1645 | 1645 | */ | 
| 1646 | 1646 | public function notBlank($message = null, $propertyPath = null) | 
| 1647 | 1647 |      { | 
| 1648 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1648 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1649 | 1649 |          { | 
| 1650 | 1650 | return $this; | 
| 1651 | 1651 | } | 
| 1652 | - if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) ) | |
| 1652 | + if (false === $this->value || (empty($this->value) && '0' != $this->value)) | |
| 1653 | 1653 |          { | 
| 1654 | 1654 | $message = $message ?: $this->overrideError; | 
| 1655 | 1655 | $message = sprintf( | 
| @@ -1672,11 +1672,11 @@ discard block | ||
| 1672 | 1672 | */ | 
| 1673 | 1673 | public function isInstanceOf($className, $message = null, $propertyPath = null) | 
| 1674 | 1674 |      { | 
| 1675 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1675 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1676 | 1676 |          { | 
| 1677 | 1677 | return $this; | 
| 1678 | 1678 | } | 
| 1679 | - if ( !( $this->value instanceof $className ) ) | |
| 1679 | + if ( ! ($this->value instanceof $className)) | |
| 1680 | 1680 |          { | 
| 1681 | 1681 | $message = $message ?: $this->overrideError; | 
| 1682 | 1682 | $message = sprintf( | 
| @@ -1684,7 +1684,7 @@ discard block | ||
| 1684 | 1684 | $this->stringify($this->value), | 
| 1685 | 1685 | $className | 
| 1686 | 1686 | ); | 
| 1687 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $propertyPath, ['class' => $className]); | |
| 1687 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $propertyPath, [ 'class' => $className ]); | |
| 1688 | 1688 | } | 
| 1689 | 1689 | return $this; | 
| 1690 | 1690 | } | 
| @@ -1700,11 +1700,11 @@ discard block | ||
| 1700 | 1700 | */ | 
| 1701 | 1701 | public function notIsInstanceOf($className, $message = null, $propertyPath = null) | 
| 1702 | 1702 |      { | 
| 1703 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1703 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1704 | 1704 |          { | 
| 1705 | 1705 | return $this; | 
| 1706 | 1706 | } | 
| 1707 | - if ( $this->value instanceof $className ) | |
| 1707 | + if ($this->value instanceof $className) | |
| 1708 | 1708 |          { | 
| 1709 | 1709 | $message = $message ?: $this->overrideError; | 
| 1710 | 1710 | $message = sprintf( | 
| @@ -1712,7 +1712,7 @@ discard block | ||
| 1712 | 1712 | $this->stringify($this->value), | 
| 1713 | 1713 | $className | 
| 1714 | 1714 | ); | 
| 1715 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $propertyPath, ['class' => $className]); | |
| 1715 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $propertyPath, [ 'class' => $className ]); | |
| 1716 | 1716 | } | 
| 1717 | 1717 | return $this; | 
| 1718 | 1718 | } | 
| @@ -1728,11 +1728,11 @@ discard block | ||
| 1728 | 1728 | */ | 
| 1729 | 1729 | public function subclassOf($className, $message = null, $propertyPath = null) | 
| 1730 | 1730 |      { | 
| 1731 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1731 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1732 | 1732 |          { | 
| 1733 | 1733 | return $this; | 
| 1734 | 1734 | } | 
| 1735 | - if ( !is_subclass_of($this->value, $className) ) | |
| 1735 | + if ( ! is_subclass_of($this->value, $className)) | |
| 1736 | 1736 |          { | 
| 1737 | 1737 | $message = $message ?: $this->overrideError; | 
| 1738 | 1738 | $message = sprintf( | 
| @@ -1740,7 +1740,7 @@ discard block | ||
| 1740 | 1740 | $this->stringify($this->value), | 
| 1741 | 1741 | $className | 
| 1742 | 1742 | ); | 
| 1743 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $propertyPath, ['class' => $className]); | |
| 1743 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $propertyPath, [ 'class' => $className ]); | |
| 1744 | 1744 | } | 
| 1745 | 1745 | return $this; | 
| 1746 | 1746 | } | 
| @@ -1757,12 +1757,12 @@ discard block | ||
| 1757 | 1757 | */ | 
| 1758 | 1758 | public function range($minValue, $maxValue, $message = null, $propertyPath = null) | 
| 1759 | 1759 |      { | 
| 1760 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1760 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1761 | 1761 |          { | 
| 1762 | 1762 | return $this; | 
| 1763 | 1763 | } | 
| 1764 | 1764 | $this->numeric($message, $propertyPath); | 
| 1765 | - if ( $this->value < $minValue || $this->value > $maxValue ) | |
| 1765 | + if ($this->value < $minValue || $this->value > $maxValue) | |
| 1766 | 1766 |          { | 
| 1767 | 1767 | $message = $message ?: $this->overrideError; | 
| 1768 | 1768 | $message = sprintf( | 
| @@ -1790,12 +1790,12 @@ discard block | ||
| 1790 | 1790 | */ | 
| 1791 | 1791 | public function min($minValue, $message = null, $propertyPath = null) | 
| 1792 | 1792 |      { | 
| 1793 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1793 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1794 | 1794 |          { | 
| 1795 | 1795 | return $this; | 
| 1796 | 1796 | } | 
| 1797 | 1797 | $this->numeric($message, $propertyPath); | 
| 1798 | - if ( $this->value < $minValue ) | |
| 1798 | + if ($this->value < $minValue) | |
| 1799 | 1799 |          { | 
| 1800 | 1800 | $message = $message ?: $this->overrideError; | 
| 1801 | 1801 | $message = sprintf( | 
| @@ -1803,7 +1803,7 @@ discard block | ||
| 1803 | 1803 | $this->stringify($this->value), | 
| 1804 | 1804 | $this->stringify($minValue) | 
| 1805 | 1805 | ); | 
| 1806 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $propertyPath, ['min' => $minValue]); | |
| 1806 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $propertyPath, [ 'min' => $minValue ]); | |
| 1807 | 1807 | } | 
| 1808 | 1808 | return $this; | 
| 1809 | 1809 | } | 
| @@ -1819,12 +1819,12 @@ discard block | ||
| 1819 | 1819 | */ | 
| 1820 | 1820 | public function max($maxValue, $message = null, $propertyPath = null) | 
| 1821 | 1821 |      { | 
| 1822 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1822 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1823 | 1823 |          { | 
| 1824 | 1824 | return $this; | 
| 1825 | 1825 | } | 
| 1826 | 1826 | $this->numeric($message, $propertyPath); | 
| 1827 | - if ( $this->value > $maxValue ) | |
| 1827 | + if ($this->value > $maxValue) | |
| 1828 | 1828 |          { | 
| 1829 | 1829 | $message = $message ?: $this->overrideError; | 
| 1830 | 1830 | $message = sprintf( | 
| @@ -1832,7 +1832,7 @@ discard block | ||
| 1832 | 1832 | $this->stringify($this->value), | 
| 1833 | 1833 | $this->stringify($maxValue) | 
| 1834 | 1834 | ); | 
| 1835 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $propertyPath, ['max' => $maxValue]); | |
| 1835 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $propertyPath, [ 'max' => $maxValue ]); | |
| 1836 | 1836 | } | 
| 1837 | 1837 | return $this; | 
| 1838 | 1838 | } | 
| @@ -1847,13 +1847,13 @@ discard block | ||
| 1847 | 1847 | */ | 
| 1848 | 1848 | public function file($message = null, $propertyPath = null) | 
| 1849 | 1849 |      { | 
| 1850 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1850 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1851 | 1851 |          { | 
| 1852 | 1852 | return $this; | 
| 1853 | 1853 | } | 
| 1854 | 1854 | $this->string($message, $propertyPath); | 
| 1855 | 1855 | $this->notEmpty($message, $propertyPath); | 
| 1856 | - if ( !is_file($this->value) ) | |
| 1856 | + if ( ! is_file($this->value)) | |
| 1857 | 1857 |          { | 
| 1858 | 1858 | $message = $message ?: $this->overrideError; | 
| 1859 | 1859 | $message = sprintf( | 
| @@ -1873,13 +1873,13 @@ discard block | ||
| 1873 | 1873 | */ | 
| 1874 | 1874 | public function fileExists($message = null, $propertyPath = null) | 
| 1875 | 1875 |      { | 
| 1876 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1876 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1877 | 1877 |          { | 
| 1878 | 1878 | return $this; | 
| 1879 | 1879 | } | 
| 1880 | 1880 | $this->string($message, $propertyPath); | 
| 1881 | 1881 | $this->notEmpty($message, $propertyPath); | 
| 1882 | - if ( ! file_exists($this->value) ) | |
| 1882 | + if ( ! file_exists($this->value)) | |
| 1883 | 1883 |          { | 
| 1884 | 1884 | $message = $message ?: $this->overrideError; | 
| 1885 | 1885 | $message = sprintf( | 
| @@ -1901,12 +1901,12 @@ discard block | ||
| 1901 | 1901 | */ | 
| 1902 | 1902 | public function directory($message = null, $propertyPath = 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->string($message, $propertyPath); | 
| 1909 | - if ( !is_dir($this->value) ) | |
| 1909 | + if ( ! is_dir($this->value)) | |
| 1910 | 1910 |          { | 
| 1911 | 1911 | $message = $message ?: $this->overrideError; | 
| 1912 | 1912 | $message = sprintf( | 
| @@ -1928,12 +1928,12 @@ discard block | ||
| 1928 | 1928 | */ | 
| 1929 | 1929 | public function readable($message = null, $propertyPath = null) | 
| 1930 | 1930 |      { | 
| 1931 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1931 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1932 | 1932 |          { | 
| 1933 | 1933 | return $this; | 
| 1934 | 1934 | } | 
| 1935 | 1935 | $this->string($message, $propertyPath); | 
| 1936 | - if ( !is_readable($this->value) ) | |
| 1936 | + if ( ! is_readable($this->value)) | |
| 1937 | 1937 |          { | 
| 1938 | 1938 | $message = $message ?: $this->overrideError; | 
| 1939 | 1939 | $message = sprintf( | 
| @@ -1955,12 +1955,12 @@ discard block | ||
| 1955 | 1955 | */ | 
| 1956 | 1956 | public function writeable($message = null, $propertyPath = null) | 
| 1957 | 1957 |      { | 
| 1958 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1958 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1959 | 1959 |          { | 
| 1960 | 1960 | return $this; | 
| 1961 | 1961 | } | 
| 1962 | 1962 | $this->string($message, $propertyPath); | 
| 1963 | - if ( !is_writeable($this->value) ) | |
| 1963 | + if ( ! is_writeable($this->value)) | |
| 1964 | 1964 |          { | 
| 1965 | 1965 | $message = $message ?: $this->overrideError; | 
| 1966 | 1966 | $message = sprintf( | 
| @@ -1983,12 +1983,12 @@ discard block | ||
| 1983 | 1983 | */ | 
| 1984 | 1984 | public function email($message = null, $propertyPath = null) | 
| 1985 | 1985 |      { | 
| 1986 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 1986 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 1987 | 1987 |          { | 
| 1988 | 1988 | return $this; | 
| 1989 | 1989 | } | 
| 1990 | 1990 | $this->string($message, $propertyPath); | 
| 1991 | - if ( ! filter_var($this->value, FILTER_VALIDATE_EMAIL) ) | |
| 1991 | + if ( ! filter_var($this->value, FILTER_VALIDATE_EMAIL)) | |
| 1992 | 1992 |          { | 
| 1993 | 1993 | $message = $message ?: $this->overrideError; | 
| 1994 | 1994 | $message = sprintf( | 
| @@ -2001,7 +2001,7 @@ discard block | ||
| 2001 | 2001 |          { | 
| 2002 | 2002 | $host = substr($this->value, strpos($this->value, '@') + 1); | 
| 2003 | 2003 | // Likely not a FQDN, bug in PHP FILTER_VALIDATE_EMAIL prior to PHP 5.3.3 | 
| 2004 | - if ( version_compare(PHP_VERSION, '5.3.3', '<') && strpos($host, '.') === false ) | |
| 2004 | + if (version_compare(PHP_VERSION, '5.3.3', '<') && strpos($host, '.') === false) | |
| 2005 | 2005 |              { | 
| 2006 | 2006 | $message = $message ?: $this->overrideError; | 
| 2007 | 2007 | $message = sprintf( | 
| @@ -2022,7 +2022,7 @@ discard block | ||
| 2022 | 2022 | */ | 
| 2023 | 2023 | public function emailPrefix($message = null, $propertyPath = null) | 
| 2024 | 2024 |      { | 
| 2025 | - $this->value($this->value . '@example.com'); | |
| 2025 | + $this->value($this->value.'@example.com'); | |
| 2026 | 2026 | return $this->email($message, $propertyPath); | 
| 2027 | 2027 | } | 
| 2028 | 2028 | |
| @@ -2042,12 +2042,12 @@ discard block | ||
| 2042 | 2042 | */ | 
| 2043 | 2043 | public function url($message = null, $propertyPath = null) | 
| 2044 | 2044 |      { | 
| 2045 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2045 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2046 | 2046 |          { | 
| 2047 | 2047 | return $this; | 
| 2048 | 2048 | } | 
| 2049 | 2049 | $this->string($message, $propertyPath); | 
| 2050 | - $protocols = ['http', 'https']; | |
| 2050 | + $protocols = [ 'http', 'https' ]; | |
| 2051 | 2051 | $pattern = '~^ | 
| 2052 | 2052 | (%s):// # protocol | 
| 2053 | 2053 | ( | 
| @@ -2062,8 +2062,8 @@ discard block | ||
| 2062 | 2062 | (:[0-9]+)? # a port (optional) | 
| 2063 | 2063 | (/?|/\S+) # a /, nothing or a / with something | 
| 2064 | 2064 | $~ixu'; | 
| 2065 | -        $pattern   = sprintf($pattern, implode('|', $protocols)); | |
| 2066 | - if ( !preg_match($pattern, $this->value) ) | |
| 2065 | +        $pattern = sprintf($pattern, implode('|', $protocols)); | |
| 2066 | + if ( ! preg_match($pattern, $this->value)) | |
| 2067 | 2067 |          { | 
| 2068 | 2068 | $message = $message ?: $this->overrideError; | 
| 2069 | 2069 | $message = sprintf( | 
| @@ -2088,13 +2088,13 @@ discard block | ||
| 2088 | 2088 | */ | 
| 2089 | 2089 | public function domainName($message = null, $propertyPath = null) | 
| 2090 | 2090 |      { | 
| 2091 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2091 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2092 | 2092 |          { | 
| 2093 | 2093 | return $this; | 
| 2094 | 2094 | } | 
| 2095 | 2095 | $this->string($message, $propertyPath); | 
| 2096 | -        $pattern   = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/'; | |
| 2097 | - if ( ! preg_match($pattern, $this->value) ) | |
| 2096 | +        $pattern = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/'; | |
| 2097 | + if ( ! preg_match($pattern, $this->value)) | |
| 2098 | 2098 |          { | 
| 2099 | 2099 | $message = $message ?: $this->overrideError; | 
| 2100 | 2100 | $message = sprintf( | 
| @@ -2116,7 +2116,7 @@ discard block | ||
| 2116 | 2116 | */ | 
| 2117 | 2117 | public function ausMobile($message = null, $propertyPath = null) | 
| 2118 | 2118 |      { | 
| 2119 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2119 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2120 | 2120 |          { | 
| 2121 | 2121 | return $this; | 
| 2122 | 2122 | } | 
| @@ -2124,7 +2124,7 @@ discard block | ||
| 2124 | 2124 |          { | 
| 2125 | 2125 |              $this->regex('/^04[0-9]{8})$/', $message, $propertyPath); | 
| 2126 | 2126 | } | 
| 2127 | - catch ( AssertionFailedException $e ) | |
| 2127 | + catch (AssertionFailedException $e) | |
| 2128 | 2128 |          { | 
| 2129 | 2129 | $message = $message ?: $this->overrideError; | 
| 2130 | 2130 | $message = sprintf( | 
| @@ -2147,7 +2147,7 @@ discard block | ||
| 2147 | 2147 | */ | 
| 2148 | 2148 | public function alnum($message = null, $propertyPath = null) | 
| 2149 | 2149 |      { | 
| 2150 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2150 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2151 | 2151 |          { | 
| 2152 | 2152 | return $this; | 
| 2153 | 2153 | } | 
| @@ -2178,11 +2178,11 @@ discard block | ||
| 2178 | 2178 | */ | 
| 2179 | 2179 | public function true($message = null, $propertyPath = null) | 
| 2180 | 2180 |      { | 
| 2181 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2181 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2182 | 2182 |          { | 
| 2183 | 2183 | return $this; | 
| 2184 | 2184 | } | 
| 2185 | - if ( $this->value !== true ) | |
| 2185 | + if ($this->value !== true) | |
| 2186 | 2186 |          { | 
| 2187 | 2187 | $message = $message ?: $this->overrideError; | 
| 2188 | 2188 | $message = sprintf( | 
| @@ -2205,11 +2205,11 @@ discard block | ||
| 2205 | 2205 | */ | 
| 2206 | 2206 | public function truthy($message = null, $propertyPath = null) | 
| 2207 | 2207 |      { | 
| 2208 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2208 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2209 | 2209 |          { | 
| 2210 | 2210 | return $this; | 
| 2211 | 2211 | } | 
| 2212 | - if ( ! $this->value ) | |
| 2212 | + if ( ! $this->value) | |
| 2213 | 2213 |          { | 
| 2214 | 2214 | $message = $message ?: $this->overrideError; | 
| 2215 | 2215 | $message = sprintf( | 
| @@ -2231,11 +2231,11 @@ discard block | ||
| 2231 | 2231 | */ | 
| 2232 | 2232 | public function false($message = null, $propertyPath = null) | 
| 2233 | 2233 |      { | 
| 2234 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2234 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2235 | 2235 |          { | 
| 2236 | 2236 | return $this; | 
| 2237 | 2237 | } | 
| 2238 | - if ( $this->value !== false ) | |
| 2238 | + if ($this->value !== false) | |
| 2239 | 2239 |          { | 
| 2240 | 2240 | $message = $message ?: $this->overrideError; | 
| 2241 | 2241 | $message = sprintf( | 
| @@ -2257,11 +2257,11 @@ discard block | ||
| 2257 | 2257 | */ | 
| 2258 | 2258 | public function notFalse($message = null, $propertyPath = null) | 
| 2259 | 2259 |      { | 
| 2260 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2260 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2261 | 2261 |          { | 
| 2262 | 2262 | return $this; | 
| 2263 | 2263 | } | 
| 2264 | - if ( $this->value === false ) | |
| 2264 | + if ($this->value === false) | |
| 2265 | 2265 |          { | 
| 2266 | 2266 | $message = $message ?: $this->overrideError; | 
| 2267 | 2267 | $message = sprintf( | 
| @@ -2283,11 +2283,11 @@ discard block | ||
| 2283 | 2283 | */ | 
| 2284 | 2284 | public function classExists($message = null, $propertyPath = null) | 
| 2285 | 2285 |      { | 
| 2286 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2286 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2287 | 2287 |          { | 
| 2288 | 2288 | return $this; | 
| 2289 | 2289 | } | 
| 2290 | - if ( !class_exists($this->value) ) | |
| 2290 | + if ( ! class_exists($this->value)) | |
| 2291 | 2291 |          { | 
| 2292 | 2292 | $message = $message ?: $this->overrideError; | 
| 2293 | 2293 | $message = sprintf( | 
| @@ -2310,12 +2310,12 @@ discard block | ||
| 2310 | 2310 | */ | 
| 2311 | 2311 | public function implementsInterface($interfaceName, $message = null, $propertyPath = null) | 
| 2312 | 2312 |      { | 
| 2313 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2313 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2314 | 2314 |          { | 
| 2315 | 2315 | return $this; | 
| 2316 | 2316 | } | 
| 2317 | 2317 | $reflection = new \ReflectionClass($this->value); | 
| 2318 | - if ( !$reflection->implementsInterface($interfaceName) ) | |
| 2318 | + if ( ! $reflection->implementsInterface($interfaceName)) | |
| 2319 | 2319 |          { | 
| 2320 | 2320 | $message = $message ?: $this->overrideError; | 
| 2321 | 2321 | $message = sprintf( | 
| @@ -2323,7 +2323,7 @@ discard block | ||
| 2323 | 2323 | $this->stringify($this->value), | 
| 2324 | 2324 | $this->stringify($interfaceName) | 
| 2325 | 2325 | ); | 
| 2326 | - throw $this->createException($message, self::INTERFACE_NOT_IMPLEMENTED, $propertyPath, ['interface' => $interfaceName]); | |
| 2326 | + throw $this->createException($message, self::INTERFACE_NOT_IMPLEMENTED, $propertyPath, [ 'interface' => $interfaceName ]); | |
| 2327 | 2327 | } | 
| 2328 | 2328 | return $this; | 
| 2329 | 2329 | } | 
| @@ -2344,11 +2344,11 @@ discard block | ||
| 2344 | 2344 | */ | 
| 2345 | 2345 | public function isJsonString($message = null, $propertyPath = null) | 
| 2346 | 2346 |      { | 
| 2347 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2347 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2348 | 2348 |          { | 
| 2349 | 2349 | return $this; | 
| 2350 | 2350 | } | 
| 2351 | - if ( null === json_decode($this->value) && JSON_ERROR_NONE !== json_last_error() ) | |
| 2351 | + if (null === json_decode($this->value) && JSON_ERROR_NONE !== json_last_error()) | |
| 2352 | 2352 |          { | 
| 2353 | 2353 | $message = $message ?: $this->overrideError; | 
| 2354 | 2354 | $message = sprintf( | 
| @@ -2372,16 +2372,16 @@ discard block | ||
| 2372 | 2372 | */ | 
| 2373 | 2373 | public function uuid($message = null, $propertyPath = null) | 
| 2374 | 2374 |      { | 
| 2375 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2375 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2376 | 2376 |          { | 
| 2377 | 2377 | return $this; | 
| 2378 | 2378 | } | 
| 2379 | -        $this->value = str_replace(['urn:', 'uuid:', '{', '}'], '', $this->value); | |
| 2380 | - if ( $this->value === '00000000-0000-0000-0000-000000000000' ) | |
| 2379 | +        $this->value = str_replace([ 'urn:', 'uuid:', '{', '}' ], '', $this->value); | |
| 2380 | + if ($this->value === '00000000-0000-0000-0000-000000000000') | |
| 2381 | 2381 |          { | 
| 2382 | 2382 | return $this; | 
| 2383 | 2383 | } | 
| 2384 | -        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) ) | |
| 2384 | +        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)) | |
| 2385 | 2385 |          { | 
| 2386 | 2386 | $message = $message ?: $this->overrideError; | 
| 2387 | 2387 | $message = sprintf( | 
| @@ -2407,11 +2407,11 @@ discard block | ||
| 2407 | 2407 | */ | 
| 2408 | 2408 | public function samAccountName($message = null, $propertyPath = null) | 
| 2409 | 2409 |      { | 
| 2410 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2410 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2411 | 2411 |          { | 
| 2412 | 2412 | return $this; | 
| 2413 | 2413 | } | 
| 2414 | -        if ( !preg_match('/^([a-z0-9]{4,20})$/', $this->value) ) | |
| 2414 | +        if ( ! preg_match('/^([a-z0-9]{4,20})$/', $this->value)) | |
| 2415 | 2415 |          { | 
| 2416 | 2416 | $message = $message ?: $this->overrideError; | 
| 2417 | 2417 | $message = sprintf( | 
| @@ -2433,11 +2433,11 @@ discard block | ||
| 2433 | 2433 | */ | 
| 2434 | 2434 | public function count($count, $message = null, $propertyPath = null) | 
| 2435 | 2435 |      { | 
| 2436 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2436 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2437 | 2437 |          { | 
| 2438 | 2438 | return $this; | 
| 2439 | 2439 | } | 
| 2440 | - if ( $count !== count($this->value) ) | |
| 2440 | + if ($count !== count($this->value)) | |
| 2441 | 2441 |          { | 
| 2442 | 2442 | $message = $message ?: $this->overrideError; | 
| 2443 | 2443 | $message = sprintf( | 
| @@ -2445,7 +2445,7 @@ discard block | ||
| 2445 | 2445 | $this->stringify($this->value), | 
| 2446 | 2446 | $this->stringify($count) | 
| 2447 | 2447 | ); | 
| 2448 | - throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $propertyPath, ['count' => $count]); | |
| 2448 | + throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $propertyPath, [ 'count' => $count ]); | |
| 2449 | 2449 | } | 
| 2450 | 2450 | return $this; | 
| 2451 | 2451 | } | 
| @@ -2458,24 +2458,24 @@ discard block | ||
| 2458 | 2458 | */ | 
| 2459 | 2459 | protected function doAllOrNullOr($func, $args) | 
| 2460 | 2460 |      { | 
| 2461 | - if ( $this->nullOr && is_null($this->value) ) | |
| 2461 | + if ($this->nullOr && is_null($this->value)) | |
| 2462 | 2462 |          { | 
| 2463 | 2463 | return true; | 
| 2464 | 2464 | } | 
| 2465 | - if ( $this->emptyOr && empty($this->value) ) | |
| 2465 | + if ($this->emptyOr && empty($this->value)) | |
| 2466 | 2466 |          { | 
| 2467 | 2467 | return true; | 
| 2468 | 2468 | } | 
| 2469 | - if ( $this->all && (new Assert($this->value))->setExceptionClass($this->exceptionClass)->isTraversable() ) | |
| 2469 | + if ($this->all && (new Assert($this->value))->setExceptionClass($this->exceptionClass)->isTraversable()) | |
| 2470 | 2470 |          { | 
| 2471 | - foreach ( $this->value as $idx => $value ) | |
| 2471 | + foreach ($this->value as $idx => $value) | |
| 2472 | 2472 |              { | 
| 2473 | 2473 | $object = (new Assert($value))->setExceptionClass($this->exceptionClass); | 
| 2474 | - call_user_func_array([$object, $func], $args); | |
| 2474 | + call_user_func_array([ $object, $func ], $args); | |
| 2475 | 2475 | } | 
| 2476 | 2476 | return true; | 
| 2477 | 2477 | } | 
| 2478 | - return ( $this->nullOr && is_null($this->value) ) || ( $this->emptyOr && empty($this->value) ) ? true : false; | |
| 2478 | + return ($this->nullOr && is_null($this->value)) || ($this->emptyOr && empty($this->value)) ? true : false; | |
| 2479 | 2479 | } | 
| 2480 | 2480 | |
| 2481 | 2481 | /** | 
| @@ -2488,12 +2488,12 @@ discard block | ||
| 2488 | 2488 | */ | 
| 2489 | 2489 | public function choicesNotEmpty(array $choices, $message = null, $propertyPath = null) | 
| 2490 | 2490 |      { | 
| 2491 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2491 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2492 | 2492 |          { | 
| 2493 | 2493 | return $this; | 
| 2494 | 2494 | } | 
| 2495 | 2495 | $this->notEmpty($message, $propertyPath); | 
| 2496 | - foreach ( $choices as $choice ) | |
| 2496 | + foreach ($choices as $choice) | |
| 2497 | 2497 |          { | 
| 2498 | 2498 | $this->notEmptyKey($choice, $message, $propertyPath); | 
| 2499 | 2499 | } | 
| @@ -2511,12 +2511,12 @@ discard block | ||
| 2511 | 2511 | */ | 
| 2512 | 2512 | public function methodExists($object, $message = null, $propertyPath = null) | 
| 2513 | 2513 |      { | 
| 2514 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2514 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2515 | 2515 |          { | 
| 2516 | 2516 | return $this; | 
| 2517 | 2517 | } | 
| 2518 | 2518 | (new Assert($object))->setExceptionClass($this->exceptionClass)->isObject($message, $propertyPath); | 
| 2519 | - if ( !method_exists($object, $this->value) ) | |
| 2519 | + if ( ! method_exists($object, $this->value)) | |
| 2520 | 2520 |          { | 
| 2521 | 2521 | $message = $message ?: $this->overrideError; | 
| 2522 | 2522 | $message = sprintf( | 
| @@ -2538,11 +2538,11 @@ discard block | ||
| 2538 | 2538 | */ | 
| 2539 | 2539 | public function isObject($message = null, $propertyPath = null) | 
| 2540 | 2540 |      { | 
| 2541 | - if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) | |
| 2541 | + if ($this->doAllOrNullOr(__FUNCTION__, func_get_args())) | |
| 2542 | 2542 |          { | 
| 2543 | 2543 | return $this; | 
| 2544 | 2544 | } | 
| 2545 | - if ( !is_object($this->value) ) | |
| 2545 | + if ( ! is_object($this->value)) | |
| 2546 | 2546 |          { | 
| 2547 | 2547 | $message = $message ?: $this->overrideError; | 
| 2548 | 2548 | $message = sprintf( | 
| @@ -2562,32 +2562,32 @@ discard block | ||
| 2562 | 2562 | */ | 
| 2563 | 2563 | private function stringify($value) | 
| 2564 | 2564 |      { | 
| 2565 | - if ( is_bool($value) ) | |
| 2565 | + if (is_bool($value)) | |
| 2566 | 2566 |          { | 
| 2567 | 2567 | return $value ? '<TRUE>' : '<FALSE>'; | 
| 2568 | 2568 | } | 
| 2569 | - if ( is_scalar($value) ) | |
| 2569 | + if (is_scalar($value)) | |
| 2570 | 2570 |          { | 
| 2571 | 2571 | $val = (string)$value; | 
| 2572 | - if ( strlen($val) > 100 ) | |
| 2572 | + if (strlen($val) > 100) | |
| 2573 | 2573 |              { | 
| 2574 | - $val = substr($val, 0, 97) . '...'; | |
| 2574 | + $val = substr($val, 0, 97).'...'; | |
| 2575 | 2575 | } | 
| 2576 | 2576 | return $val; | 
| 2577 | 2577 | } | 
| 2578 | - if ( is_array($value) ) | |
| 2578 | + if (is_array($value)) | |
| 2579 | 2579 |          { | 
| 2580 | 2580 | return '<ARRAY>'; | 
| 2581 | 2581 | } | 
| 2582 | - if ( is_object($value) ) | |
| 2582 | + if (is_object($value)) | |
| 2583 | 2583 |          { | 
| 2584 | 2584 | return get_class($value); | 
| 2585 | 2585 | } | 
| 2586 | - if ( is_resource($value) ) | |
| 2586 | + if (is_resource($value)) | |
| 2587 | 2587 |          { | 
| 2588 | 2588 | return '<RESOURCE>'; | 
| 2589 | 2589 | } | 
| 2590 | - if ( $value === null ) | |
| 2590 | + if ($value === null) | |
| 2591 | 2591 |          { | 
| 2592 | 2592 | return '<NULL>'; | 
| 2593 | 2593 | } |