| @@ 1590-1600 (lines=11) @@ | ||
| 1587 | * |
|
| 1588 | * @throws InvalidArgumentException |
|
| 1589 | */ |
|
| 1590 | public static function file($value, $message = '') |
|
| 1591 | { |
|
| 1592 | static::fileExists($value, $message); |
|
| 1593 | ||
| 1594 | if (!\is_file($value)) { |
|
| 1595 | static::reportInvalidArgument(\sprintf( |
|
| 1596 | $message ?: 'The path %s is not a file.', |
|
| 1597 | static::valueToString($value) |
|
| 1598 | )); |
|
| 1599 | } |
|
| 1600 | } |
|
| 1601 | ||
| 1602 | /** |
|
| 1603 | * @param mixed $value |
|
| @@ 1608-1618 (lines=11) @@ | ||
| 1605 | * |
|
| 1606 | * @throws InvalidArgumentException |
|
| 1607 | */ |
|
| 1608 | public static function directory($value, $message = '') |
|
| 1609 | { |
|
| 1610 | static::fileExists($value, $message); |
|
| 1611 | ||
| 1612 | if (!\is_dir($value)) { |
|
| 1613 | static::reportInvalidArgument(\sprintf( |
|
| 1614 | $message ?: 'The path %s is no directory.', |
|
| 1615 | static::valueToString($value) |
|
| 1616 | )); |
|
| 1617 | } |
|
| 1618 | } |
|
| 1619 | ||
| 1620 | /** |
|
| 1621 | * @param string $value |
|