Conditions | 5 |
Paths | 5 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 68 | public static function assertFilenameExists(string $value, string $message = ''): void |
|
30 | { |
||
31 | 68 | if (!is_readable($value)) { |
|
32 | 12 | $format = '' === $message ? '%1$s does not exist or is not readable' : $message; |
|
33 | 12 | $message = sprintf($format, self::valueToString($value)); |
|
34 | 12 | throw new InvalidArgumentException($message); |
|
35 | } |
||
36 | |||
37 | 56 | if (!is_file($value)) { |
|
38 | 2 | $format = '' === $message ? '%1$s is not a regular file' : $message; |
|
39 | 2 | $message = sprintf($format, self::valueToString($value)); |
|
40 | 2 | throw new InvalidArgumentException($message); |
|
41 | } |
||
44 |