| @@ 1443-1453 (lines=11) @@ | ||
| 1440 | * |
|
| 1441 | * @throws InvalidArgumentException |
|
| 1442 | */ |
|
| 1443 | public static function file($value, $message = '') |
|
| 1444 | { |
|
| 1445 | static::fileExists($value, $message); |
|
| 1446 | ||
| 1447 | if (!\is_file($value)) { |
|
| 1448 | static::reportInvalidArgument(\sprintf( |
|
| 1449 | $message ?: 'The path %s is not a file.', |
|
| 1450 | static::valueToString($value) |
|
| 1451 | )); |
|
| 1452 | } |
|
| 1453 | } |
|
| 1454 | ||
| 1455 | /** |
|
| 1456 | * @param mixed $value |
|
| @@ 1461-1471 (lines=11) @@ | ||
| 1458 | * |
|
| 1459 | * @throws InvalidArgumentException |
|
| 1460 | */ |
|
| 1461 | public static function directory($value, $message = '') |
|
| 1462 | { |
|
| 1463 | static::fileExists($value, $message); |
|
| 1464 | ||
| 1465 | if (!\is_dir($value)) { |
|
| 1466 | static::reportInvalidArgument(\sprintf( |
|
| 1467 | $message ?: 'The path %s is no directory.', |
|
| 1468 | static::valueToString($value) |
|
| 1469 | )); |
|
| 1470 | } |
|
| 1471 | } |
|
| 1472 | ||
| 1473 | /** |
|
| 1474 | * @param mixed $value |
|