| @@ 308-317 (lines=10) @@ | ||
| 305 | { |
|
| 306 | return $this; |
|
| 307 | } |
|
| 308 | if ( $this->value != $value2 ) |
|
| 309 | { |
|
| 310 | $message = $message ?: $this->overrideError; |
|
| 311 | $message = sprintf( |
|
| 312 | $message ?: 'Value "%s" does not equal expected value "%s".', |
|
| 313 | $this->stringify($this->value), |
|
| 314 | $this->stringify($value2) |
|
| 315 | ); |
|
| 316 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]); |
|
| 317 | } |
|
| 318 | return $this; |
|
| 319 | } |
|
| 320 | ||
| @@ 335-344 (lines=10) @@ | ||
| 332 | { |
|
| 333 | return $this; |
|
| 334 | } |
|
| 335 | if ( ! ( $this->value > $value2 ) ) |
|
| 336 | { |
|
| 337 | $message = $message ?: $this->overrideError; |
|
| 338 | $message = sprintf( |
|
| 339 | $message ?: 'Value "%s" does not greater then expected value "%s".', |
|
| 340 | $this->stringify($this->value), |
|
| 341 | $this->stringify($value2) |
|
| 342 | ); |
|
| 343 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]); |
|
| 344 | } |
|
| 345 | return $this; |
|
| 346 | } |
|
| 347 | ||
| @@ 362-371 (lines=10) @@ | ||
| 359 | { |
|
| 360 | return $this; |
|
| 361 | } |
|
| 362 | if ( ! ( $this->value >= $value2 ) ) |
|
| 363 | { |
|
| 364 | $message = $message ?: $this->overrideError; |
|
| 365 | $message = sprintf( |
|
| 366 | $message ?: 'Value "%s" does not greater than or equal to expected value "%s".', |
|
| 367 | $this->stringify($this->value), |
|
| 368 | $this->stringify($value2) |
|
| 369 | ); |
|
| 370 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]); |
|
| 371 | } |
|
| 372 | return $this; |
|
| 373 | } |
|
| 374 | ||
| @@ 389-398 (lines=10) @@ | ||
| 386 | { |
|
| 387 | return $this; |
|
| 388 | } |
|
| 389 | if ( ! ( $this->value < $value2 ) ) |
|
| 390 | { |
|
| 391 | $message = $message ?: $this->overrideError; |
|
| 392 | $message = sprintf( |
|
| 393 | $message ?: 'Value "%s" does not less then expected value "%s".', |
|
| 394 | $this->stringify($this->value), |
|
| 395 | $this->stringify($value2) |
|
| 396 | ); |
|
| 397 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $propertyPath, ['expected' => $value2]); |
|
| 398 | } |
|
| 399 | return $this; |
|
| 400 | } |
|
| 401 | ||
| @@ 416-425 (lines=10) @@ | ||
| 413 | { |
|
| 414 | return $this; |
|
| 415 | } |
|
| 416 | if ( ! ( $this->value <= $value2 ) ) |
|
| 417 | { |
|
| 418 | $message = $message ?: $this->overrideError; |
|
| 419 | $message = sprintf( |
|
| 420 | $message ?: 'Value "%s" does not less than or equal to expected value "%s".', |
|
| 421 | $this->stringify($this->value), |
|
| 422 | $this->stringify($value2) |
|
| 423 | ); |
|
| 424 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $propertyPath, ['expected' => $value2]); |
|
| 425 | } |
|
| 426 | return $this; |
|
| 427 | } |
|
| 428 | ||
| @@ 444-453 (lines=10) @@ | ||
| 441 | { |
|
| 442 | return $this; |
|
| 443 | } |
|
| 444 | if ( $this->value !== $value2 ) |
|
| 445 | { |
|
| 446 | $message = $message ?: $this->overrideError; |
|
| 447 | $message = sprintf( |
|
| 448 | $message ?: 'Value "%s" is not the same as expected value "%s".', |
|
| 449 | $this->stringify($this->value), |
|
| 450 | $this->stringify($value2) |
|
| 451 | ); |
|
| 452 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $propertyPath, ['expected' => $value2]); |
|
| 453 | } |
|
| 454 | return $this; |
|
| 455 | } |
|
| 456 | ||
| @@ 472-481 (lines=10) @@ | ||
| 469 | { |
|
| 470 | return $this; |
|
| 471 | } |
|
| 472 | if ( $this->value == $value2 ) |
|
| 473 | { |
|
| 474 | $message = $message ?: $this->overrideError; |
|
| 475 | $message = sprintf( |
|
| 476 | $message ?: 'Value "%s" is equal to expected value "%s".', |
|
| 477 | $this->stringify($this->value), |
|
| 478 | $this->stringify($value2) |
|
| 479 | ); |
|
| 480 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $propertyPath, ['expected' => $value2]); |
|
| 481 | } |
|
| 482 | return $this; |
|
| 483 | } |
|
| 484 | ||
| @@ 525-534 (lines=10) @@ | ||
| 522 | { |
|
| 523 | return $this; |
|
| 524 | } |
|
| 525 | if ( $this->value === $value2 ) |
|
| 526 | { |
|
| 527 | $message = $message ?: $this->overrideError; |
|
| 528 | $message = sprintf( |
|
| 529 | $message ?: 'Value "%s" is the same as expected value "%s".', |
|
| 530 | $this->stringify($this->value), |
|
| 531 | $this->stringify($value2) |
|
| 532 | ); |
|
| 533 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $propertyPath, ['expected' => $value2]); |
|
| 534 | } |
|
| 535 | return $this; |
|
| 536 | } |
|
| 537 | ||
| @@ 926-934 (lines=9) @@ | ||
| 923 | return $this; |
|
| 924 | } |
|
| 925 | $this->string($message, $propertyPath); |
|
| 926 | if ( ! preg_match($pattern, $this->value) ) |
|
| 927 | { |
|
| 928 | $message = $message ?: $this->overrideError; |
|
| 929 | $message = sprintf( |
|
| 930 | $message ?: 'Value "%s" does not match expression.', |
|
| 931 | $this->stringify($this->value) |
|
| 932 | ); |
|
| 933 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]); |
|
| 934 | } |
|
| 935 | return $this; |
|
| 936 | } |
|
| 937 | ||
| @@ 978-986 (lines=9) @@ | ||
| 975 | return $this; |
|
| 976 | } |
|
| 977 | $this->string($message, $propertyPath); |
|
| 978 | if ( preg_match($pattern, $this->value) ) |
|
| 979 | { |
|
| 980 | $message = $message ?: $this->overrideError; |
|
| 981 | $message = sprintf( |
|
| 982 | $message ?: 'Value "%s" does not match expression.', |
|
| 983 | $this->stringify($this->value) |
|
| 984 | ); |
|
| 985 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]); |
|
| 986 | } |
|
| 987 | return $this; |
|
| 988 | } |
|
| 989 | ||
| @@ 1678-1687 (lines=10) @@ | ||
| 1675 | { |
|
| 1676 | return $this; |
|
| 1677 | } |
|
| 1678 | if ( !( $this->value instanceof $className ) ) |
|
| 1679 | { |
|
| 1680 | $message = $message ?: $this->overrideError; |
|
| 1681 | $message = sprintf( |
|
| 1682 | $message ?: 'Class "%s" was expected to be instanceof of "%s" but is not.', |
|
| 1683 | $this->stringify($this->value), |
|
| 1684 | $className |
|
| 1685 | ); |
|
| 1686 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $propertyPath, ['class' => $className]); |
|
| 1687 | } |
|
| 1688 | return $this; |
|
| 1689 | } |
|
| 1690 | ||
| @@ 1706-1715 (lines=10) @@ | ||
| 1703 | { |
|
| 1704 | return $this; |
|
| 1705 | } |
|
| 1706 | if ( $this->value instanceof $className ) |
|
| 1707 | { |
|
| 1708 | $message = $message ?: $this->overrideError; |
|
| 1709 | $message = sprintf( |
|
| 1710 | $message ?: 'Class "%s" was not expected to be instanceof of "%s".', |
|
| 1711 | $this->stringify($this->value), |
|
| 1712 | $className |
|
| 1713 | ); |
|
| 1714 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $propertyPath, ['class' => $className]); |
|
| 1715 | } |
|
| 1716 | return $this; |
|
| 1717 | } |
|
| 1718 | ||
| @@ 1734-1743 (lines=10) @@ | ||
| 1731 | { |
|
| 1732 | return $this; |
|
| 1733 | } |
|
| 1734 | if ( !is_subclass_of($this->value, $className) ) |
|
| 1735 | { |
|
| 1736 | $message = $message ?: $this->overrideError; |
|
| 1737 | $message = sprintf( |
|
| 1738 | $message ?: 'Class "%s" was expected to be subclass of "%s".', |
|
| 1739 | $this->stringify($this->value), |
|
| 1740 | $className |
|
| 1741 | ); |
|
| 1742 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $propertyPath, ['class' => $className]); |
|
| 1743 | } |
|
| 1744 | return $this; |
|
| 1745 | } |
|
| 1746 | ||
| @@ 1797-1806 (lines=10) @@ | ||
| 1794 | return $this; |
|
| 1795 | } |
|
| 1796 | $this->numeric($message, $propertyPath); |
|
| 1797 | if ( $this->value < $minValue ) |
|
| 1798 | { |
|
| 1799 | $message = $message ?: $this->overrideError; |
|
| 1800 | $message = sprintf( |
|
| 1801 | $message ?: 'Number "%s" was expected to be at least "%d".', |
|
| 1802 | $this->stringify($this->value), |
|
| 1803 | $this->stringify($minValue) |
|
| 1804 | ); |
|
| 1805 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $propertyPath, ['min' => $minValue]); |
|
| 1806 | } |
|
| 1807 | return $this; |
|
| 1808 | } |
|
| 1809 | ||
| @@ 1826-1835 (lines=10) @@ | ||
| 1823 | return $this; |
|
| 1824 | } |
|
| 1825 | $this->numeric($message, $propertyPath); |
|
| 1826 | if ( $this->value > $maxValue ) |
|
| 1827 | { |
|
| 1828 | $message = $message ?: $this->overrideError; |
|
| 1829 | $message = sprintf( |
|
| 1830 | $message ?: 'Number "%s" was expected to be at most "%d".', |
|
| 1831 | $this->stringify($this->value), |
|
| 1832 | $this->stringify($maxValue) |
|
| 1833 | ); |
|
| 1834 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $propertyPath, ['max' => $maxValue]); |
|
| 1835 | } |
|
| 1836 | return $this; |
|
| 1837 | } |
|
| 1838 | ||
| @@ 2410-2419 (lines=10) @@ | ||
| 2407 | { |
|
| 2408 | return $this; |
|
| 2409 | } |
|
| 2410 | if ( $count !== count($this->value) ) |
|
| 2411 | { |
|
| 2412 | $message = $message ?: $this->overrideError; |
|
| 2413 | $message = sprintf( |
|
| 2414 | $message ?: 'List does not contain exactly "%d" elements.', |
|
| 2415 | $this->stringify($this->value), |
|
| 2416 | $this->stringify($count) |
|
| 2417 | ); |
|
| 2418 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $propertyPath, ['count' => $count]); |
|
| 2419 | } |
|
| 2420 | return $this; |
|
| 2421 | } |
|
| 2422 | ||