| @@ 1070-1079 (lines=10) @@ | ||
| 1067 | * |
|
| 1068 | * @throws InvalidArgumentException |
|
| 1069 | */ |
|
| 1070 | public static function endsWith($value, $suffix, $message = '') |
|
| 1071 | { |
|
| 1072 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
| 1073 | static::reportInvalidArgument(\sprintf( |
|
| 1074 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 1075 | static::valueToString($value), |
|
| 1076 | static::valueToString($suffix) |
|
| 1077 | )); |
|
| 1078 | } |
|
| 1079 | } |
|
| 1080 | ||
| 1081 | /** |
|
| 1082 | * @param mixed $value |
|
| @@ 1473-1482 (lines=10) @@ | ||
| 1470 | * |
|
| 1471 | * @throws InvalidArgumentException |
|
| 1472 | */ |
|
| 1473 | public static function implementsInterface($value, $interface, $message = '') |
|
| 1474 | { |
|
| 1475 | if (!\in_array($interface, \class_implements($value))) { |
|
| 1476 | static::reportInvalidArgument(\sprintf( |
|
| 1477 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 1478 | static::valueToString($value), |
|
| 1479 | static::valueToString($interface) |
|
| 1480 | )); |
|
| 1481 | } |
|
| 1482 | } |
|
| 1483 | ||
| 1484 | /** |
|
| 1485 | * @param string|object $classOrObject |
|