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