| @@ 1427-1437 (lines=11) @@ | ||
| 1424 | * |
|
| 1425 | * @throws InvalidArgumentException |
|
| 1426 | */ |
|
| 1427 | public static function file($value, $message = '') |
|
| 1428 | { |
|
| 1429 | static::fileExists($value, $message); |
|
| 1430 | ||
| 1431 | if (!\is_file($value)) { |
|
| 1432 | static::reportInvalidArgument(\sprintf( |
|
| 1433 | $message ?: 'The path %s is not a file.', |
|
| 1434 | static::valueToString($value) |
|
| 1435 | )); |
|
| 1436 | } |
|
| 1437 | } |
|
| 1438 | ||
| 1439 | /** |
|
| 1440 | * @param mixed $value |
|
| @@ 1445-1455 (lines=11) @@ | ||
| 1442 | * |
|
| 1443 | * @throws InvalidArgumentException |
|
| 1444 | */ |
|
| 1445 | public static function directory($value, $message = '') |
|
| 1446 | { |
|
| 1447 | static::fileExists($value, $message); |
|
| 1448 | ||
| 1449 | if (!\is_dir($value)) { |
|
| 1450 | static::reportInvalidArgument(\sprintf( |
|
| 1451 | $message ?: 'The path %s is no directory.', |
|
| 1452 | static::valueToString($value) |
|
| 1453 | )); |
|
| 1454 | } |
|
| 1455 | } |
|
| 1456 | ||
| 1457 | /** |
|
| 1458 | * @param string $value |
|