@@ 529-538 (lines=10) @@ | ||
526 | } |
|
527 | } |
|
528 | ||
529 | public static function endsWith($value, $suffix, $message = '') |
|
530 | { |
|
531 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
532 | static::reportInvalidArgument(sprintf( |
|
533 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
534 | static::valueToString($value), |
|
535 | static::valueToString($suffix) |
|
536 | )); |
|
537 | } |
|
538 | } |
|
539 | ||
540 | public static function regex($value, $pattern, $message = '') |
|
541 | { |
|
@@ 749-758 (lines=10) @@ | ||
746 | } |
|
747 | } |
|
748 | ||
749 | public static function implementsInterface($value, $interface, $message = '') |
|
750 | { |
|
751 | if (!in_array($interface, class_implements($value))) { |
|
752 | static::reportInvalidArgument(sprintf( |
|
753 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
754 | static::valueToString($value), |
|
755 | static::valueToString($interface) |
|
756 | )); |
|
757 | } |
|
758 | } |
|
759 | ||
760 | public static function propertyExists($classOrObject, $property, $message = '') |
|
761 | { |