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