@@ 285-294 (lines=10) @@ | ||
282 | { |
|
283 | return $this; |
|
284 | } |
|
285 | if ( $this->value != $value2 ) |
|
286 | { |
|
287 | $message = $message ?: $this->overrideError; |
|
288 | $message = sprintf( |
|
289 | $message ?: 'Value "%s" does not equal expected value "%s".', |
|
290 | $this->stringify($this->value), |
|
291 | $this->stringify($value2) |
|
292 | ); |
|
293 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]); |
|
294 | } |
|
295 | return $this; |
|
296 | } |
|
297 | ||
@@ 312-321 (lines=10) @@ | ||
309 | { |
|
310 | return $this; |
|
311 | } |
|
312 | if ( ! ( $this->value > $value2 ) ) |
|
313 | { |
|
314 | $message = $message ?: $this->overrideError; |
|
315 | $message = sprintf( |
|
316 | $message ?: 'Value "%s" does not greater then expected value "%s".', |
|
317 | $this->stringify($this->value), |
|
318 | $this->stringify($value2) |
|
319 | ); |
|
320 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]); |
|
321 | } |
|
322 | return $this; |
|
323 | } |
|
324 | ||
@@ 339-348 (lines=10) @@ | ||
336 | { |
|
337 | return $this; |
|
338 | } |
|
339 | if ( ! ( $this->value >= $value2 ) ) |
|
340 | { |
|
341 | $message = $message ?: $this->overrideError; |
|
342 | $message = sprintf( |
|
343 | $message ?: 'Value "%s" does not greater than or equal to expected value "%s".', |
|
344 | $this->stringify($this->value), |
|
345 | $this->stringify($value2) |
|
346 | ); |
|
347 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $propertyPath, ['expected' => $value2]); |
|
348 | } |
|
349 | return $this; |
|
350 | } |
|
351 | ||
@@ 366-375 (lines=10) @@ | ||
363 | { |
|
364 | return $this; |
|
365 | } |
|
366 | if ( ! ( $this->value < $value2 ) ) |
|
367 | { |
|
368 | $message = $message ?: $this->overrideError; |
|
369 | $message = sprintf( |
|
370 | $message ?: 'Value "%s" does not less then expected value "%s".', |
|
371 | $this->stringify($this->value), |
|
372 | $this->stringify($value2) |
|
373 | ); |
|
374 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $propertyPath, ['expected' => $value2]); |
|
375 | } |
|
376 | return $this; |
|
377 | } |
|
378 | ||
@@ 393-402 (lines=10) @@ | ||
390 | { |
|
391 | return $this; |
|
392 | } |
|
393 | if ( ! ( $this->value <= $value2 ) ) |
|
394 | { |
|
395 | $message = $message ?: $this->overrideError; |
|
396 | $message = sprintf( |
|
397 | $message ?: 'Value "%s" does not less than or equal to expected value "%s".', |
|
398 | $this->stringify($this->value), |
|
399 | $this->stringify($value2) |
|
400 | ); |
|
401 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $propertyPath, ['expected' => $value2]); |
|
402 | } |
|
403 | return $this; |
|
404 | } |
|
405 | ||
@@ 421-430 (lines=10) @@ | ||
418 | { |
|
419 | return $this; |
|
420 | } |
|
421 | if ( $this->value !== $value2 ) |
|
422 | { |
|
423 | $message = $message ?: $this->overrideError; |
|
424 | $message = sprintf( |
|
425 | $message ?: 'Value "%s" is not the same as expected value "%s".', |
|
426 | $this->stringify($this->value), |
|
427 | $this->stringify($value2) |
|
428 | ); |
|
429 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $propertyPath, ['expected' => $value2]); |
|
430 | } |
|
431 | return $this; |
|
432 | } |
|
433 | ||
@@ 449-458 (lines=10) @@ | ||
446 | { |
|
447 | return $this; |
|
448 | } |
|
449 | if ( $this->value == $value2 ) |
|
450 | { |
|
451 | $message = $message ?: $this->overrideError; |
|
452 | $message = sprintf( |
|
453 | $message ?: 'Value "%s" is equal to expected value "%s".', |
|
454 | $this->stringify($this->value), |
|
455 | $this->stringify($value2) |
|
456 | ); |
|
457 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $propertyPath, ['expected' => $value2]); |
|
458 | } |
|
459 | return $this; |
|
460 | } |
|
461 | ||
@@ 502-511 (lines=10) @@ | ||
499 | { |
|
500 | return $this; |
|
501 | } |
|
502 | if ( $this->value === $value2 ) |
|
503 | { |
|
504 | $message = $message ?: $this->overrideError; |
|
505 | $message = sprintf( |
|
506 | $message ?: 'Value "%s" is the same as expected value "%s".', |
|
507 | $this->stringify($this->value), |
|
508 | $this->stringify($value2) |
|
509 | ); |
|
510 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $propertyPath, ['expected' => $value2]); |
|
511 | } |
|
512 | return $this; |
|
513 | } |
|
514 | ||
@@ 903-911 (lines=9) @@ | ||
900 | return $this; |
|
901 | } |
|
902 | $this->string($message, $propertyPath); |
|
903 | if ( ! preg_match($pattern, $this->value) ) |
|
904 | { |
|
905 | $message = $message ?: $this->overrideError; |
|
906 | $message = sprintf( |
|
907 | $message ?: 'Value "%s" does not match expression.', |
|
908 | $this->stringify($this->value) |
|
909 | ); |
|
910 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]); |
|
911 | } |
|
912 | return $this; |
|
913 | } |
|
914 | ||
@@ 955-963 (lines=9) @@ | ||
952 | return $this; |
|
953 | } |
|
954 | $this->string($message, $propertyPath); |
|
955 | if ( preg_match($pattern, $this->value) ) |
|
956 | { |
|
957 | $message = $message ?: $this->overrideError; |
|
958 | $message = sprintf( |
|
959 | $message ?: 'Value "%s" does not match expression.', |
|
960 | $this->stringify($this->value) |
|
961 | ); |
|
962 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]); |
|
963 | } |
|
964 | return $this; |
|
965 | } |
|
966 | ||
@@ 1655-1664 (lines=10) @@ | ||
1652 | { |
|
1653 | return $this; |
|
1654 | } |
|
1655 | if ( !( $this->value instanceof $className ) ) |
|
1656 | { |
|
1657 | $message = $message ?: $this->overrideError; |
|
1658 | $message = sprintf( |
|
1659 | $message ?: 'Class "%s" was expected to be instanceof of "%s" but is not.', |
|
1660 | $this->stringify($this->value), |
|
1661 | $className |
|
1662 | ); |
|
1663 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $propertyPath, ['class' => $className]); |
|
1664 | } |
|
1665 | return $this; |
|
1666 | } |
|
1667 | ||
@@ 1683-1692 (lines=10) @@ | ||
1680 | { |
|
1681 | return $this; |
|
1682 | } |
|
1683 | if ( $this->value instanceof $className ) |
|
1684 | { |
|
1685 | $message = $message ?: $this->overrideError; |
|
1686 | $message = sprintf( |
|
1687 | $message ?: 'Class "%s" was not expected to be instanceof of "%s".', |
|
1688 | $this->stringify($this->value), |
|
1689 | $className |
|
1690 | ); |
|
1691 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $propertyPath, ['class' => $className]); |
|
1692 | } |
|
1693 | return $this; |
|
1694 | } |
|
1695 | ||
@@ 1711-1720 (lines=10) @@ | ||
1708 | { |
|
1709 | return $this; |
|
1710 | } |
|
1711 | if ( !is_subclass_of($this->value, $className) ) |
|
1712 | { |
|
1713 | $message = $message ?: $this->overrideError; |
|
1714 | $message = sprintf( |
|
1715 | $message ?: 'Class "%s" was expected to be subclass of "%s".', |
|
1716 | $this->stringify($this->value), |
|
1717 | $className |
|
1718 | ); |
|
1719 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $propertyPath, ['class' => $className]); |
|
1720 | } |
|
1721 | return $this; |
|
1722 | } |
|
1723 | ||
@@ 1774-1783 (lines=10) @@ | ||
1771 | return $this; |
|
1772 | } |
|
1773 | $this->numeric($message, $propertyPath); |
|
1774 | if ( $this->value < $minValue ) |
|
1775 | { |
|
1776 | $message = $message ?: $this->overrideError; |
|
1777 | $message = sprintf( |
|
1778 | $message ?: 'Number "%s" was expected to be at least "%d".', |
|
1779 | $this->stringify($this->value), |
|
1780 | $this->stringify($minValue) |
|
1781 | ); |
|
1782 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $propertyPath, ['min' => $minValue]); |
|
1783 | } |
|
1784 | return $this; |
|
1785 | } |
|
1786 | ||
@@ 1803-1812 (lines=10) @@ | ||
1800 | return $this; |
|
1801 | } |
|
1802 | $this->numeric($message, $propertyPath); |
|
1803 | if ( $this->value > $maxValue ) |
|
1804 | { |
|
1805 | $message = $message ?: $this->overrideError; |
|
1806 | $message = sprintf( |
|
1807 | $message ?: 'Number "%s" was expected to be at most "%d".', |
|
1808 | $this->stringify($this->value), |
|
1809 | $this->stringify($maxValue) |
|
1810 | ); |
|
1811 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $propertyPath, ['max' => $maxValue]); |
|
1812 | } |
|
1813 | return $this; |
|
1814 | } |
|
1815 | ||
@@ 2355-2364 (lines=10) @@ | ||
2352 | { |
|
2353 | return $this; |
|
2354 | } |
|
2355 | if ( $count !== count($this->value) ) |
|
2356 | { |
|
2357 | $message = $message ?: $this->overrideError; |
|
2358 | $message = sprintf( |
|
2359 | $message ?: 'List does not contain exactly "%d" elements.', |
|
2360 | $this->stringify($this->value), |
|
2361 | $this->stringify($count) |
|
2362 | ); |
|
2363 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $propertyPath, ['count' => $count]); |
|
2364 | } |
|
2365 | return $this; |
|
2366 | } |
|
2367 |