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