@@ 979-988 (lines=10) @@ | ||
976 | * @param string $suffix |
|
977 | * @param string $message |
|
978 | */ |
|
979 | public static function endsWith($value, $suffix, $message = '') |
|
980 | { |
|
981 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
982 | static::reportInvalidArgument(\sprintf( |
|
983 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
984 | static::valueToString($value), |
|
985 | static::valueToString($suffix) |
|
986 | )); |
|
987 | } |
|
988 | } |
|
989 | ||
990 | /** |
|
991 | * @param mixed $value |
|
@@ 1338-1347 (lines=10) @@ | ||
1335 | * @param mixed $interface |
|
1336 | * @param string $message |
|
1337 | */ |
|
1338 | public static function implementsInterface($value, $interface, $message = '') |
|
1339 | { |
|
1340 | if (!\in_array($interface, \class_implements($value))) { |
|
1341 | static::reportInvalidArgument(\sprintf( |
|
1342 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
1343 | static::valueToString($value), |
|
1344 | static::valueToString($interface) |
|
1345 | )); |
|
1346 | } |
|
1347 | } |
|
1348 | ||
1349 | /** |
|
1350 | * @param string|object $classOrObject |