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