| @@ 1024-1033 (lines=10) @@ | ||
| 1021 | * @param string $suffix |
|
| 1022 | * @param string $message |
|
| 1023 | */ |
|
| 1024 | public static function endsWith($value, $suffix, $message = '') |
|
| 1025 | { |
|
| 1026 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
| 1027 | static::reportInvalidArgument(\sprintf( |
|
| 1028 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 1029 | static::valueToString($value), |
|
| 1030 | static::valueToString($suffix) |
|
| 1031 | )); |
|
| 1032 | } |
|
| 1033 | } |
|
| 1034 | ||
| 1035 | /** |
|
| 1036 | * @param mixed $value |
|
| @@ 1385-1394 (lines=10) @@ | ||
| 1382 | * @param mixed $interface |
|
| 1383 | * @param string $message |
|
| 1384 | */ |
|
| 1385 | public static function implementsInterface($value, $interface, $message = '') |
|
| 1386 | { |
|
| 1387 | if (!\in_array($interface, \class_implements($value))) { |
|
| 1388 | static::reportInvalidArgument(\sprintf( |
|
| 1389 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 1390 | static::valueToString($value), |
|
| 1391 | static::valueToString($interface) |
|
| 1392 | )); |
|
| 1393 | } |
|
| 1394 | } |
|
| 1395 | ||
| 1396 | /** |
|
| 1397 | * @param string|object $classOrObject |
|