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