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