@@ 1079-1088 (lines=10) @@ | ||
1076 | * |
|
1077 | * @throws InvalidArgumentException |
|
1078 | */ |
|
1079 | public static function endsWith($value, $suffix, $message = '') |
|
1080 | { |
|
1081 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
1082 | static::reportInvalidArgument(\sprintf( |
|
1083 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
1084 | static::valueToString($value), |
|
1085 | static::valueToString($suffix) |
|
1086 | )); |
|
1087 | } |
|
1088 | } |
|
1089 | ||
1090 | /** |
|
1091 | * @param mixed $value |
|
@@ 1486-1495 (lines=10) @@ | ||
1483 | * |
|
1484 | * @throws InvalidArgumentException |
|
1485 | */ |
|
1486 | public static function implementsInterface($value, $interface, $message = '') |
|
1487 | { |
|
1488 | if (!\in_array($interface, \class_implements($value))) { |
|
1489 | static::reportInvalidArgument(\sprintf( |
|
1490 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
1491 | static::valueToString($value), |
|
1492 | static::valueToString($interface) |
|
1493 | )); |
|
1494 | } |
|
1495 | } |
|
1496 | ||
1497 | /** |
|
1498 | * @param string|object $classOrObject |