@@ 1282-1291 (lines=10) @@ | ||
1279 | * |
|
1280 | * @throws InvalidArgumentException |
|
1281 | */ |
|
1282 | public static function endsWith($value, $suffix, $message = '') |
|
1283 | { |
|
1284 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
1285 | static::reportInvalidArgument(\sprintf( |
|
1286 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
1287 | static::valueToString($value), |
|
1288 | static::valueToString($suffix) |
|
1289 | )); |
|
1290 | } |
|
1291 | } |
|
1292 | ||
1293 | /** |
|
1294 | * @psalm-pure |
|
@@ 1302-1311 (lines=10) @@ | ||
1299 | * |
|
1300 | * @throws InvalidArgumentException |
|
1301 | */ |
|
1302 | public static function notEndsWith($value, $suffix, $message = '') |
|
1303 | { |
|
1304 | if ($suffix === \substr($value, -\strlen($suffix))) { |
|
1305 | static::reportInvalidArgument(\sprintf( |
|
1306 | $message ?: 'Expected a value not to end with %2$s. Got: %s', |
|
1307 | static::valueToString($value), |
|
1308 | static::valueToString($suffix) |
|
1309 | )); |
|
1310 | } |
|
1311 | } |
|
1312 | ||
1313 | /** |
|
1314 | * @psalm-pure |
|
@@ 1737-1746 (lines=10) @@ | ||
1734 | * |
|
1735 | * @throws InvalidArgumentException |
|
1736 | */ |
|
1737 | public static function implementsInterface($value, $interface, $message = '') |
|
1738 | { |
|
1739 | if (!\in_array($interface, \class_implements($value))) { |
|
1740 | static::reportInvalidArgument(\sprintf( |
|
1741 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
1742 | static::valueToString($value), |
|
1743 | static::valueToString($interface) |
|
1744 | )); |
|
1745 | } |
|
1746 | } |
|
1747 | ||
1748 | /** |
|
1749 | * @psalm-pure |