@@ 1163-1172 (lines=10) @@ | ||
1160 | * |
|
1161 | * @throws InvalidArgumentException |
|
1162 | */ |
|
1163 | public static function endsWith($value, $suffix, $message = '') |
|
1164 | { |
|
1165 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
1166 | static::reportInvalidArgument(\sprintf( |
|
1167 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
1168 | static::valueToString($value), |
|
1169 | static::valueToString($suffix) |
|
1170 | )); |
|
1171 | } |
|
1172 | } |
|
1173 | ||
1174 | /** |
|
1175 | * @param mixed $value |
|
@@ 1566-1575 (lines=10) @@ | ||
1563 | * |
|
1564 | * @throws InvalidArgumentException |
|
1565 | */ |
|
1566 | public static function implementsInterface($value, $interface, $message = '') |
|
1567 | { |
|
1568 | if (!\in_array($interface, \class_implements($value))) { |
|
1569 | static::reportInvalidArgument(\sprintf( |
|
1570 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
1571 | static::valueToString($value), |
|
1572 | static::valueToString($interface) |
|
1573 | )); |
|
1574 | } |
|
1575 | } |
|
1576 | ||
1577 | /** |
|
1578 | * @param string|object $classOrObject |