| @@ 1390-1400 (lines=11) @@ | ||
| 1387 | * |
|
| 1388 | * @throws InvalidArgumentException |
|
| 1389 | */ |
|
| 1390 | public static function file($value, $message = '') |
|
| 1391 | { |
|
| 1392 | static::fileExists($value, $message); |
|
| 1393 | ||
| 1394 | if (!\is_file($value)) { |
|
| 1395 | static::reportInvalidArgument(\sprintf( |
|
| 1396 | $message ?: 'The path %s is not a file.', |
|
| 1397 | static::valueToString($value) |
|
| 1398 | )); |
|
| 1399 | } |
|
| 1400 | } |
|
| 1401 | ||
| 1402 | /** |
|
| 1403 | * @param string $value |
|
| @@ 1408-1418 (lines=11) @@ | ||
| 1405 | * |
|
| 1406 | * @throws InvalidArgumentException |
|
| 1407 | */ |
|
| 1408 | public static function directory($value, $message = '') |
|
| 1409 | { |
|
| 1410 | static::fileExists($value, $message); |
|
| 1411 | ||
| 1412 | if (!\is_dir($value)) { |
|
| 1413 | static::reportInvalidArgument(\sprintf( |
|
| 1414 | $message ?: 'The path %s is no directory.', |
|
| 1415 | static::valueToString($value) |
|
| 1416 | )); |
|
| 1417 | } |
|
| 1418 | } |
|
| 1419 | ||
| 1420 | /** |
|
| 1421 | * @param string $value |
|