@@ 618-627 (lines=10) @@ | ||
615 | } |
|
616 | } |
|
617 | ||
618 | public static function endsWith($value, $suffix, $message = '') |
|
619 | { |
|
620 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
621 | static::reportInvalidArgument(sprintf( |
|
622 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
623 | static::valueToString($value), |
|
624 | static::valueToString($suffix) |
|
625 | )); |
|
626 | } |
|
627 | } |
|
628 | ||
629 | public static function regex($value, $pattern, $message = '') |
|
630 | { |
|
@@ 838-847 (lines=10) @@ | ||
835 | } |
|
836 | } |
|
837 | ||
838 | public static function implementsInterface($value, $interface, $message = '') |
|
839 | { |
|
840 | if (!in_array($interface, class_implements($value))) { |
|
841 | static::reportInvalidArgument(sprintf( |
|
842 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
843 | static::valueToString($value), |
|
844 | static::valueToString($interface) |
|
845 | )); |
|
846 | } |
|
847 | } |
|
848 | ||
849 | public static function propertyExists($classOrObject, $property, $message = '') |
|
850 | { |