| @@ 1560-1570 (lines=11) @@ | ||
| 1557 | * |
|
| 1558 | * @throws InvalidArgumentException |
|
| 1559 | */ |
|
| 1560 | public static function file($value, $message = '') |
|
| 1561 | { |
|
| 1562 | static::fileExists($value, $message); |
|
| 1563 | ||
| 1564 | if (!\is_file($value)) { |
|
| 1565 | static::reportInvalidArgument(\sprintf( |
|
| 1566 | $message ?: 'The path %s is not a file.', |
|
| 1567 | static::valueToString($value) |
|
| 1568 | )); |
|
| 1569 | } |
|
| 1570 | } |
|
| 1571 | ||
| 1572 | /** |
|
| 1573 | * @param mixed $value |
|
| @@ 1578-1588 (lines=11) @@ | ||
| 1575 | * |
|
| 1576 | * @throws InvalidArgumentException |
|
| 1577 | */ |
|
| 1578 | public static function directory($value, $message = '') |
|
| 1579 | { |
|
| 1580 | static::fileExists($value, $message); |
|
| 1581 | ||
| 1582 | if (!\is_dir($value)) { |
|
| 1583 | static::reportInvalidArgument(\sprintf( |
|
| 1584 | $message ?: 'The path %s is no directory.', |
|
| 1585 | static::valueToString($value) |
|
| 1586 | )); |
|
| 1587 | } |
|
| 1588 | } |
|
| 1589 | ||
| 1590 | /** |
|
| 1591 | * @param string $value |
|