| Total Complexity | 5 |
| Total Lines | 63 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class PdfExportService extends AbstractService |
||
| 12 | { |
||
| 13 | // todo: add ability to pass urls to export |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Provide a view to build the PDF from. |
||
| 17 | * |
||
| 18 | * @param View $view |
||
| 19 | * @return PdfExporter |
||
| 20 | * @throws Exception |
||
| 21 | */ |
||
| 22 | public static function fromView(View $view): PdfExporter |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Create a view to build the PDF from. |
||
| 29 | * |
||
| 30 | * @param string $viewName |
||
| 31 | * @param array $viewData |
||
| 32 | * @return PdfExporter |
||
| 33 | * @throws Exception |
||
| 34 | */ |
||
| 35 | public static function fromViewData(string $viewName, array $viewData = []): PdfExporter |
||
| 36 | { |
||
| 37 | return new PdfExporter(view($viewName, $viewData)); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Provide a view to build the PDF from. |
||
| 42 | * |
||
| 43 | * @param AbstractViewModel $viewModel |
||
| 44 | * @return PdfExporter |
||
| 45 | * @throws Exception |
||
| 46 | */ |
||
| 47 | public static function fromViewModel(AbstractViewModel $viewModel): PdfExporter |
||
| 48 | { |
||
| 49 | return new PdfExporter($viewModel->renderNoCache()); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Provide an HTML string to build the PDF from. |
||
| 54 | * |
||
| 55 | * @param string $html |
||
| 56 | * @return PdfExporter |
||
| 57 | * @throws Exception |
||
| 58 | */ |
||
| 59 | public static function fromHtml(string $html): PdfExporter |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Provide an HTML path to build the PDF from. |
||
| 66 | * |
||
| 67 | * @param string $path |
||
| 68 | * @return PdfExporter |
||
| 69 | * @throws Exception |
||
| 70 | */ |
||
| 71 | public static function fromHtmlPath(string $path): PdfExporter |
||
| 74 | } |
||
| 75 | } |
||
| 76 |