@@ 523-532 (lines=10) @@ | ||
520 | } |
|
521 | } |
|
522 | ||
523 | public static function endsWith($value, $suffix, $message = '') |
|
524 | { |
|
525 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
526 | static::reportInvalidArgument(sprintf( |
|
527 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
528 | static::valueToString($value), |
|
529 | static::valueToString($suffix) |
|
530 | )); |
|
531 | } |
|
532 | } |
|
533 | ||
534 | public static function regex($value, $pattern, $message = '') |
|
535 | { |
|
@@ 743-752 (lines=10) @@ | ||
740 | } |
|
741 | } |
|
742 | ||
743 | public static function implementsInterface($value, $interface, $message = '') |
|
744 | { |
|
745 | if (!in_array($interface, class_implements($value))) { |
|
746 | static::reportInvalidArgument(sprintf( |
|
747 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
748 | static::valueToString($value), |
|
749 | static::valueToString($interface) |
|
750 | )); |
|
751 | } |
|
752 | } |
|
753 | ||
754 | public static function propertyExists($classOrObject, $property, $message = '') |
|
755 | { |