@@ 511-520 (lines=10) @@ | ||
508 | } |
|
509 | } |
|
510 | ||
511 | public static function endsWith($value, $suffix, $message = '') |
|
512 | { |
|
513 | if ($suffix !== substr($value, -static::strlen($suffix))) { |
|
514 | static::reportInvalidArgument(sprintf( |
|
515 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
516 | static::valueToString($value), |
|
517 | static::valueToString($suffix) |
|
518 | )); |
|
519 | } |
|
520 | } |
|
521 | ||
522 | public static function regex($value, $pattern, $message = '') |
|
523 | { |
|
@@ 731-740 (lines=10) @@ | ||
728 | } |
|
729 | } |
|
730 | ||
731 | public static function implementsInterface($value, $interface, $message = '') |
|
732 | { |
|
733 | if (!in_array($interface, class_implements($value))) { |
|
734 | static::reportInvalidArgument(sprintf( |
|
735 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
736 | static::valueToString($value), |
|
737 | static::valueToString($interface) |
|
738 | )); |
|
739 | } |
|
740 | } |
|
741 | ||
742 | public static function propertyExists($classOrObject, $property, $message = '') |
|
743 | { |