| @@ 1647-1657 (lines=11) @@ | ||
| 1644 | * |
|
| 1645 | * @throws InvalidArgumentException |
|
| 1646 | */ |
|
| 1647 | public static function directory($value, $message = '') |
|
| 1648 | { |
|
| 1649 | static::fileExists($value, $message); |
|
| 1650 | ||
| 1651 | if (!\is_dir($value)) { |
|
| 1652 | static::reportInvalidArgument(\sprintf( |
|
| 1653 | $message ?: 'The path %s is no directory.', |
|
| 1654 | static::valueToString($value) |
|
| 1655 | )); |
|
| 1656 | } |
|
| 1657 | } |
|
| 1658 | ||
| 1659 | /** |
|
| 1660 | * @param string $value |
|
| @@ 1629-1639 (lines=11) @@ | ||
| 1626 | * |
|
| 1627 | * @throws InvalidArgumentException |
|
| 1628 | */ |
|
| 1629 | public static function file($value, $message = '') |
|
| 1630 | { |
|
| 1631 | static::fileExists($value, $message); |
|
| 1632 | ||
| 1633 | if (!\is_file($value)) { |
|
| 1634 | static::reportInvalidArgument(\sprintf( |
|
| 1635 | $message ?: 'The path %s is not a file.', |
|
| 1636 | static::valueToString($value) |
|
| 1637 | )); |
|
| 1638 | } |
|
| 1639 | } |
|
| 1640 | ||
| 1641 | /** |
|
| 1642 | * @param mixed $value |
|