@@ 620-629 (lines=10) @@ | ||
617 | } |
|
618 | } |
|
619 | ||
620 | public static function endsWith($value, $suffix, $message = '') |
|
621 | { |
|
622 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
623 | static::reportInvalidArgument(sprintf( |
|
624 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
625 | static::valueToString($value), |
|
626 | static::valueToString($suffix) |
|
627 | )); |
|
628 | } |
|
629 | } |
|
630 | ||
631 | public static function regex($value, $pattern, $message = '') |
|
632 | { |
|
@@ 850-859 (lines=10) @@ | ||
847 | } |
|
848 | } |
|
849 | ||
850 | public static function implementsInterface($value, $interface, $message = '') |
|
851 | { |
|
852 | if (!in_array($interface, class_implements($value))) { |
|
853 | static::reportInvalidArgument(sprintf( |
|
854 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
855 | static::valueToString($value), |
|
856 | static::valueToString($interface) |
|
857 | )); |
|
858 | } |
|
859 | } |
|
860 | ||
861 | public static function propertyExists($classOrObject, $property, $message = '') |
|
862 | { |