| @@ 1465-1475 (lines=11) @@ | ||
| 1462 | * |
|
| 1463 | * @throws InvalidArgumentException |
|
| 1464 | */ |
|
| 1465 | public static function file($value, $message = '') |
|
| 1466 | { |
|
| 1467 | static::fileExists($value, $message); |
|
| 1468 | ||
| 1469 | if (!\is_file($value)) { |
|
| 1470 | static::reportInvalidArgument(\sprintf( |
|
| 1471 | $message ?: 'The path %s is not a file.', |
|
| 1472 | static::valueToString($value) |
|
| 1473 | )); |
|
| 1474 | } |
|
| 1475 | } |
|
| 1476 | ||
| 1477 | /** |
|
| 1478 | * @param mixed $value |
|
| @@ 1483-1493 (lines=11) @@ | ||
| 1480 | * |
|
| 1481 | * @throws InvalidArgumentException |
|
| 1482 | */ |
|
| 1483 | public static function directory($value, $message = '') |
|
| 1484 | { |
|
| 1485 | static::fileExists($value, $message); |
|
| 1486 | ||
| 1487 | if (!\is_dir($value)) { |
|
| 1488 | static::reportInvalidArgument(\sprintf( |
|
| 1489 | $message ?: 'The path %s is no directory.', |
|
| 1490 | static::valueToString($value) |
|
| 1491 | )); |
|
| 1492 | } |
|
| 1493 | } |
|
| 1494 | ||
| 1495 | /** |
|
| 1496 | * @param string $value |
|