| @@ 1562-1572 (lines=11) @@ | ||
| 1559 | * |
|
| 1560 | * @throws InvalidArgumentException |
|
| 1561 | */ |
|
| 1562 | public static function file($value, $message = '') |
|
| 1563 | { |
|
| 1564 | static::fileExists($value, $message); |
|
| 1565 | ||
| 1566 | if (!\is_file($value)) { |
|
| 1567 | static::reportInvalidArgument(\sprintf( |
|
| 1568 | $message ?: 'The path %s is not a file.', |
|
| 1569 | static::valueToString($value) |
|
| 1570 | )); |
|
| 1571 | } |
|
| 1572 | } |
|
| 1573 | ||
| 1574 | /** |
|
| 1575 | * @param mixed $value |
|
| @@ 1580-1590 (lines=11) @@ | ||
| 1577 | * |
|
| 1578 | * @throws InvalidArgumentException |
|
| 1579 | */ |
|
| 1580 | public static function directory($value, $message = '') |
|
| 1581 | { |
|
| 1582 | static::fileExists($value, $message); |
|
| 1583 | ||
| 1584 | if (!\is_dir($value)) { |
|
| 1585 | static::reportInvalidArgument(\sprintf( |
|
| 1586 | $message ?: 'The path %s is no directory.', |
|
| 1587 | static::valueToString($value) |
|
| 1588 | )); |
|
| 1589 | } |
|
| 1590 | } |
|
| 1591 | ||
| 1592 | /** |
|
| 1593 | * @param string $value |
|