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