@@ 516-525 (lines=10) @@ | ||
513 | } |
|
514 | } |
|
515 | ||
516 | public static function endsWith($value, $suffix, $message = '') |
|
517 | { |
|
518 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
519 | static::reportInvalidArgument(sprintf( |
|
520 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
521 | static::valueToString($value), |
|
522 | static::valueToString($suffix) |
|
523 | )); |
|
524 | } |
|
525 | } |
|
526 | ||
527 | public static function regex($value, $pattern, $message = '') |
|
528 | { |
|
@@ 736-745 (lines=10) @@ | ||
733 | } |
|
734 | } |
|
735 | ||
736 | public static function implementsInterface($value, $interface, $message = '') |
|
737 | { |
|
738 | if (!in_array($interface, class_implements($value))) { |
|
739 | static::reportInvalidArgument(sprintf( |
|
740 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
741 | static::valueToString($value), |
|
742 | static::valueToString($interface) |
|
743 | )); |
|
744 | } |
|
745 | } |
|
746 | ||
747 | public static function propertyExists($classOrObject, $property, $message = '') |
|
748 | { |