| Total Complexity | 4 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | class FileChecker |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * Checks whether a file exists. |
||
| 24 | */ |
||
| 25 | 111 | public function checkFileExists(string $file, string $message = 'File "%s" not found!'): void |
|
| 26 | { |
||
| 27 | 111 | $exceptionMessage = (false !== strpos($message, '%s')) ? sprintf($message, $file) : $message; |
|
| 28 | |||
| 29 | 111 | if (!file_exists($file)) { |
|
| 30 | 10 | throw new FileNotFoundException($exceptionMessage); |
|
| 31 | } |
||
| 32 | 101 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * Checks whether a PDF file exists. |
||
| 36 | */ |
||
| 37 | 60 | public function checkPdfFileExists(string $file): void |
|
| 40 | 52 | } |
|
| 41 | } |
||
| 42 |