2020-07-09 16:05:17 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\PdfMaker;
|
|
|
|
|
|
|
|
class PdfMaker
|
|
|
|
{
|
|
|
|
use PdfMakerUtilities;
|
|
|
|
|
|
|
|
protected $data;
|
|
|
|
|
|
|
|
public $design;
|
|
|
|
|
|
|
|
public $html;
|
|
|
|
|
|
|
|
public $document;
|
|
|
|
|
|
|
|
private $xpath;
|
|
|
|
|
2020-07-13 13:51:54 +02:00
|
|
|
public function __construct(array $data)
|
2020-07-09 16:05:17 +02:00
|
|
|
{
|
|
|
|
$this->data = $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function design(string $design)
|
|
|
|
{
|
|
|
|
$this->design = new $design();
|
|
|
|
|
|
|
|
$this->initializeDomDocument();
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function build()
|
|
|
|
{
|
2020-07-13 17:49:28 +02:00
|
|
|
// $raw = $this->design->html();
|
2020-07-09 16:05:17 +02:00
|
|
|
|
2020-07-13 17:49:28 +02:00
|
|
|
$this->updateElementProperties($this->data['template']);
|
2020-07-13 14:16:18 +02:00
|
|
|
$this->updateVariables($this->data['variables']);
|
2020-07-09 16:05:17 +02:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCompiledHTML()
|
|
|
|
{
|
|
|
|
return $this->document->saveHTML();
|
|
|
|
}
|
|
|
|
}
|