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