| Conditions | 5 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | 94 | public static function assertFilenameExists(string $value, string $message = ''): void |
|
| 44 | { |
||
| 45 | 94 | if (!is_readable($value)) { |
|
| 46 | 18 | $format = $message ?: '%1$s does not exist or is not readable'; |
|
| 47 | 18 | $message = sprintf($format, self::valueToString($value)); |
|
| 48 | 18 | throw new InvalidArgumentException($message); |
|
| 49 | } |
||
| 50 | |||
| 51 | 76 | if (!is_file($value)) { |
|
| 52 | 3 | $format = $message ?: '%1$s is not a regular file'; |
|
| 53 | 3 | $message = sprintf($format, self::valueToString($value)); |
|
| 54 | 3 | throw new InvalidArgumentException($message); |
|
| 55 | } |
||
| 58 |