| @@ 1422-1432 (lines=11) @@ | ||
| 1419 | * |
|
| 1420 | * @throws InvalidArgumentException |
|
| 1421 | */ |
|
| 1422 | public static function file($value, $message = '') |
|
| 1423 | { |
|
| 1424 | static::fileExists($value, $message); |
|
| 1425 | ||
| 1426 | if (!\is_file($value)) { |
|
| 1427 | static::reportInvalidArgument(\sprintf( |
|
| 1428 | $message ?: 'The path %s is not a file.', |
|
| 1429 | static::valueToString($value) |
|
| 1430 | )); |
|
| 1431 | } |
|
| 1432 | } |
|
| 1433 | ||
| 1434 | /** |
|
| 1435 | * @param mixed $value |
|
| @@ 1440-1450 (lines=11) @@ | ||
| 1437 | * |
|
| 1438 | * @throws InvalidArgumentException |
|
| 1439 | */ |
|
| 1440 | public static function directory($value, $message = '') |
|
| 1441 | { |
|
| 1442 | static::fileExists($value, $message); |
|
| 1443 | ||
| 1444 | if (!\is_dir($value)) { |
|
| 1445 | static::reportInvalidArgument(\sprintf( |
|
| 1446 | $message ?: 'The path %s is no directory.', |
|
| 1447 | static::valueToString($value) |
|
| 1448 | )); |
|
| 1449 | } |
|
| 1450 | } |
|
| 1451 | ||
| 1452 | /** |
|
| 1453 | * @param mixed $value |
|