| 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 |
||
| 38 | 68 | public static function assertFilenameExists(string $value, string $message = ''): void |
|
| 39 | { |
||
| 40 | 68 | if (!is_readable($value)) { |
|
| 41 | 12 | $format = 0 === strlen($message) ? '%1$s does not exist or is not readable' : $message; |
|
| 42 | 12 | $message = sprintf($format, self::valueToString($value)); |
|
| 43 | 12 | throw new InvalidArgumentException($message); |
|
| 44 | } |
||
| 45 | |||
| 46 | 56 | if (!is_file($value)) { |
|
| 47 | 2 | $format = 0 === strlen($message) ? '%1$s is not a regular file' : $message; |
|
| 48 | 2 | $message = sprintf($format, self::valueToString($value)); |
|
| 49 | 2 | throw new InvalidArgumentException($message); |
|
| 50 | } |
||
| 53 |