| @@ 1649-1659 (lines=11) @@ | ||
| 1646 | * |
|
| 1647 | * @throws InvalidArgumentException |
|
| 1648 | */ |
|
| 1649 | public static function file($value, $message = '') |
|
| 1650 | { |
|
| 1651 | static::fileExists($value, $message); |
|
| 1652 | ||
| 1653 | if (!\is_file($value)) { |
|
| 1654 | static::reportInvalidArgument(\sprintf( |
|
| 1655 | $message ?: 'The path %s is not a file.', |
|
| 1656 | static::valueToString($value) |
|
| 1657 | )); |
|
| 1658 | } |
|
| 1659 | } |
|
| 1660 | ||
| 1661 | /** |
|
| 1662 | * @param mixed $value |
|
| @@ 1667-1677 (lines=11) @@ | ||
| 1664 | * |
|
| 1665 | * @throws InvalidArgumentException |
|
| 1666 | */ |
|
| 1667 | public static function directory($value, $message = '') |
|
| 1668 | { |
|
| 1669 | static::fileExists($value, $message); |
|
| 1670 | ||
| 1671 | if (!\is_dir($value)) { |
|
| 1672 | static::reportInvalidArgument(\sprintf( |
|
| 1673 | $message ?: 'The path %s is no directory.', |
|
| 1674 | static::valueToString($value) |
|
| 1675 | )); |
|
| 1676 | } |
|
| 1677 | } |
|
| 1678 | ||
| 1679 | /** |
|
| 1680 | * @param string $value |
|