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