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