| @@ 1094-1103 (lines=10) @@ | ||
| 1091 | * |
|
| 1092 | * @throws InvalidArgumentException |
|
| 1093 | */ |
|
| 1094 | public static function endsWith($value, $suffix, $message = '') |
|
| 1095 | { |
|
| 1096 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
| 1097 | static::reportInvalidArgument(\sprintf( |
|
| 1098 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
| 1099 | static::valueToString($value), |
|
| 1100 | static::valueToString($suffix) |
|
| 1101 | )); |
|
| 1102 | } |
|
| 1103 | } |
|
| 1104 | ||
| 1105 | /** |
|
| 1106 | * @param mixed $value |
|
| @@ 1501-1510 (lines=10) @@ | ||
| 1498 | * |
|
| 1499 | * @throws InvalidArgumentException |
|
| 1500 | */ |
|
| 1501 | public static function implementsInterface($value, $interface, $message = '') |
|
| 1502 | { |
|
| 1503 | if (!\in_array($interface, \class_implements($value))) { |
|
| 1504 | static::reportInvalidArgument(\sprintf( |
|
| 1505 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
| 1506 | static::valueToString($value), |
|
| 1507 | static::valueToString($interface) |
|
| 1508 | )); |
|
| 1509 | } |
|
| 1510 | } |
|
| 1511 | ||
| 1512 | /** |
|
| 1513 | * @param string|object $classOrObject |
|