| @@ 1608-1618 (lines=11) @@ | ||
| 1605 | * |
|
| 1606 | * @throws InvalidArgumentException |
|
| 1607 | */ |
|
| 1608 | public static function file($value, $message = '') |
|
| 1609 | { |
|
| 1610 | static::fileExists($value, $message); |
|
| 1611 | ||
| 1612 | if (!\is_file($value)) { |
|
| 1613 | static::reportInvalidArgument(\sprintf( |
|
| 1614 | $message ?: 'The path %s is not a file.', |
|
| 1615 | static::valueToString($value) |
|
| 1616 | )); |
|
| 1617 | } |
|
| 1618 | } |
|
| 1619 | ||
| 1620 | /** |
|
| 1621 | * @param mixed $value |
|
| @@ 1626-1636 (lines=11) @@ | ||
| 1623 | * |
|
| 1624 | * @throws InvalidArgumentException |
|
| 1625 | */ |
|
| 1626 | public static function directory($value, $message = '') |
|
| 1627 | { |
|
| 1628 | static::fileExists($value, $message); |
|
| 1629 | ||
| 1630 | if (!\is_dir($value)) { |
|
| 1631 | static::reportInvalidArgument(\sprintf( |
|
| 1632 | $message ?: 'The path %s is no directory.', |
|
| 1633 | static::valueToString($value) |
|
| 1634 | )); |
|
| 1635 | } |
|
| 1636 | } |
|
| 1637 | ||
| 1638 | /** |
|
| 1639 | * @param string $value |
|