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