@@ 1446-1456 (lines=11) @@ | ||
1443 | * |
|
1444 | * @throws InvalidArgumentException |
|
1445 | */ |
|
1446 | public static function file($value, $message = '') |
|
1447 | { |
|
1448 | static::fileExists($value, $message); |
|
1449 | ||
1450 | if (!\is_file($value)) { |
|
1451 | static::reportInvalidArgument(\sprintf( |
|
1452 | $message ?: 'The path %s is not a file.', |
|
1453 | static::valueToString($value) |
|
1454 | )); |
|
1455 | } |
|
1456 | } |
|
1457 | ||
1458 | /** |
|
1459 | * @param mixed $value |
|
@@ 1464-1474 (lines=11) @@ | ||
1461 | * |
|
1462 | * @throws InvalidArgumentException |
|
1463 | */ |
|
1464 | public static function directory($value, $message = '') |
|
1465 | { |
|
1466 | static::fileExists($value, $message); |
|
1467 | ||
1468 | if (!\is_dir($value)) { |
|
1469 | static::reportInvalidArgument(\sprintf( |
|
1470 | $message ?: 'The path %s is no directory.', |
|
1471 | static::valueToString($value) |
|
1472 | )); |
|
1473 | } |
|
1474 | } |
|
1475 | ||
1476 | /** |
|
1477 | * @param string $value |