| @@ 1142-1151 (lines=10) @@ | ||
| 1139 | * |
|
| 1140 | * @throws InvalidArgumentException |
|
| 1141 | */ |
|
| 1142 | public static function endsWith($value, $suffix, $message = '') |
|
| 1143 | { |
|
| 1144 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
| 1145 | static::reportInvalidArgument(\sprintf( |
|
| 1146 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 1147 | static::valueToString($value), |
|
| 1148 | static::valueToString($suffix) |
|
| 1149 | )); |
|
| 1150 | } |
|
| 1151 | } |
|
| 1152 | ||
| 1153 | /** |
|
| 1154 | * @param mixed $value |
|
| @@ 1545-1554 (lines=10) @@ | ||
| 1542 | * |
|
| 1543 | * @throws InvalidArgumentException |
|
| 1544 | */ |
|
| 1545 | public static function implementsInterface($value, $interface, $message = '') |
|
| 1546 | { |
|
| 1547 | if (!\in_array($interface, \class_implements($value))) { |
|
| 1548 | static::reportInvalidArgument(\sprintf( |
|
| 1549 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 1550 | static::valueToString($value), |
|
| 1551 | static::valueToString($interface) |
|
| 1552 | )); |
|
| 1553 | } |
|
| 1554 | } |
|
| 1555 | ||
| 1556 | /** |
|
| 1557 | * @param string|object $classOrObject |
|