45 lines
1.0 KiB
PHP
45 lines
1.0 KiB
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace RprtCli\Utils\PdfExport;
|
||
|
|
||
|
/**
|
||
|
* Handles exporting parsed csv data to pdf files.
|
||
|
*/
|
||
|
interface PdfExportInterface {
|
||
|
|
||
|
/**
|
||
|
* Retrieves path to template file either from command option, configuration
|
||
|
* or from uer input.
|
||
|
*/
|
||
|
public function getTemplatePath(): ?string;
|
||
|
|
||
|
public function setTemplatePath(string $path): void;
|
||
|
|
||
|
/**
|
||
|
* Creates html table from parsed csv data.
|
||
|
*
|
||
|
* @param array $data
|
||
|
* First line is header. The rest of them is table body.
|
||
|
*/
|
||
|
public function parsedDataToHtmlTable(array $data): ?string;
|
||
|
|
||
|
/**
|
||
|
* Reads the template file and replaces token values.
|
||
|
*/
|
||
|
public function replaceTokensInTemplate(string $template_path, array $tokens): ?string;
|
||
|
|
||
|
/**
|
||
|
* Creates and export file.
|
||
|
*
|
||
|
* @param string $html
|
||
|
* Template file with tokens replaced.
|
||
|
*
|
||
|
* @return bool
|
||
|
* True if export was successfull.
|
||
|
*/
|
||
|
public function pdfExport(string $html) : bool;
|
||
|
|
||
|
}
|