| @@ 1358-1368 (lines=11) @@ | ||
| 1355 | * |
|
| 1356 | * @throws InvalidArgumentException |
|
| 1357 | */ |
|
| 1358 | public static function file($value, $message = '') |
|
| 1359 | { |
|
| 1360 | static::fileExists($value, $message); |
|
| 1361 | ||
| 1362 | if (!\is_file($value)) { |
|
| 1363 | static::reportInvalidArgument(\sprintf( |
|
| 1364 | $message ?: 'The path %s is not a file.', |
|
| 1365 | static::valueToString($value) |
|
| 1366 | )); |
|
| 1367 | } |
|
| 1368 | } |
|
| 1369 | ||
| 1370 | /** |
|
| 1371 | * @param mixed $value |
|
| @@ 1376-1386 (lines=11) @@ | ||
| 1373 | * |
|
| 1374 | * @throws InvalidArgumentException |
|
| 1375 | */ |
|
| 1376 | public static function directory($value, $message = '') |
|
| 1377 | { |
|
| 1378 | static::fileExists($value, $message); |
|
| 1379 | ||
| 1380 | if (!\is_dir($value)) { |
|
| 1381 | static::reportInvalidArgument(\sprintf( |
|
| 1382 | $message ?: 'The path %s is no directory.', |
|
| 1383 | static::valueToString($value) |
|
| 1384 | )); |
|
| 1385 | } |
|
| 1386 | } |
|
| 1387 | ||
| 1388 | /** |
|
| 1389 | * @param mixed $value |
|