| @@ 1487-1497 (lines=11) @@ | ||
| 1484 | * |
|
| 1485 | * @throws InvalidArgumentException |
|
| 1486 | */ |
|
| 1487 | public static function file($value, $message = '') |
|
| 1488 | { |
|
| 1489 | static::fileExists($value, $message); |
|
| 1490 | ||
| 1491 | if (!\is_file($value)) { |
|
| 1492 | static::reportInvalidArgument(\sprintf( |
|
| 1493 | $message ?: 'The path %s is not a file.', |
|
| 1494 | static::valueToString($value) |
|
| 1495 | )); |
|
| 1496 | } |
|
| 1497 | } |
|
| 1498 | ||
| 1499 | /** |
|
| 1500 | * @param mixed $value |
|
| @@ 1505-1515 (lines=11) @@ | ||
| 1502 | * |
|
| 1503 | * @throws InvalidArgumentException |
|
| 1504 | */ |
|
| 1505 | public static function directory($value, $message = '') |
|
| 1506 | { |
|
| 1507 | static::fileExists($value, $message); |
|
| 1508 | ||
| 1509 | if (!\is_dir($value)) { |
|
| 1510 | static::reportInvalidArgument(\sprintf( |
|
| 1511 | $message ?: 'The path %s is no directory.', |
|
| 1512 | static::valueToString($value) |
|
| 1513 | )); |
|
| 1514 | } |
|
| 1515 | } |
|
| 1516 | ||
| 1517 | /** |
|
| 1518 | * @param string $value |
|