| @@ 1544-1554 (lines=11) @@ | ||
| 1541 | * |
|
| 1542 | * @throws InvalidArgumentException |
|
| 1543 | */ |
|
| 1544 | public static function file($value, $message = '') |
|
| 1545 | { |
|
| 1546 | static::fileExists($value, $message); |
|
| 1547 | ||
| 1548 | if (!\is_file($value)) { |
|
| 1549 | static::reportInvalidArgument(\sprintf( |
|
| 1550 | $message ?: 'The path %s is not a file.', |
|
| 1551 | static::valueToString($value) |
|
| 1552 | )); |
|
| 1553 | } |
|
| 1554 | } |
|
| 1555 | ||
| 1556 | /** |
|
| 1557 | * @param mixed $value |
|
| @@ 1562-1572 (lines=11) @@ | ||
| 1559 | * |
|
| 1560 | * @throws InvalidArgumentException |
|
| 1561 | */ |
|
| 1562 | public static function directory($value, $message = '') |
|
| 1563 | { |
|
| 1564 | static::fileExists($value, $message); |
|
| 1565 | ||
| 1566 | if (!\is_dir($value)) { |
|
| 1567 | static::reportInvalidArgument(\sprintf( |
|
| 1568 | $message ?: 'The path %s is no directory.', |
|
| 1569 | static::valueToString($value) |
|
| 1570 | )); |
|
| 1571 | } |
|
| 1572 | } |
|
| 1573 | ||
| 1574 | /** |
|
| 1575 | * @param string $value |
|