Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| PdfRenderingException | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| mpdfNotInstalled | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| renderingFailed | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Modules\Pdf\Domain\Exception; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use RuntimeException; |
| 12 | use Throwable; |
| 13 | |
| 14 | /** |
| 15 | * Exception thrown when PDF document rendering fails. |
| 16 | * |
| 17 | * @package App\Modules\Pdf\Domain\Exception |
| 18 | */ |
| 19 | final class PdfRenderingException extends RuntimeException |
| 20 | { |
| 21 | public static function mpdfNotInstalled(): self |
| 22 | { |
| 23 | return new self('mPDF library is not installed. Please run "composer require mpdf/mpdf".'); |
| 24 | } |
| 25 | |
| 26 | public static function renderingFailed(string $message, ?Throwable $previous = null): self |
| 27 | { |
| 28 | return new self('Failed to render PDF document: ' . $message, 0, $previous); |
| 29 | } |
| 30 | } |