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