| @@ 1486-1496 (lines=11) @@ | ||
| 1483 | * |
|
| 1484 | * @throws InvalidArgumentException |
|
| 1485 | */ |
|
| 1486 | public static function file($value, $message = '') |
|
| 1487 | { |
|
| 1488 | static::fileExists($value, $message); |
|
| 1489 | ||
| 1490 | if (!\is_file($value)) { |
|
| 1491 | static::reportInvalidArgument(\sprintf( |
|
| 1492 | $message ?: 'The path %s is not a file.', |
|
| 1493 | static::valueToString($value) |
|
| 1494 | )); |
|
| 1495 | } |
|
| 1496 | } |
|
| 1497 | ||
| 1498 | /** |
|
| 1499 | * @param mixed $value |
|
| @@ 1504-1514 (lines=11) @@ | ||
| 1501 | * |
|
| 1502 | * @throws InvalidArgumentException |
|
| 1503 | */ |
|
| 1504 | public static function directory($value, $message = '') |
|
| 1505 | { |
|
| 1506 | static::fileExists($value, $message); |
|
| 1507 | ||
| 1508 | if (!\is_dir($value)) { |
|
| 1509 | static::reportInvalidArgument(\sprintf( |
|
| 1510 | $message ?: 'The path %s is no directory.', |
|
| 1511 | static::valueToString($value) |
|
| 1512 | )); |
|
| 1513 | } |
|
| 1514 | } |
|
| 1515 | ||
| 1516 | /** |
|
| 1517 | * @param string $value |
|