alex-kalanis /
pohoda
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This file is part of riesenia/pohoda package. |
||
| 5 | * |
||
| 6 | * Licensed under the MIT License |
||
| 7 | * (c) RIESENIA.com |
||
| 8 | */ |
||
| 9 | |||
| 10 | declare(strict_types=1); |
||
| 11 | |||
| 12 | namespace Riesenia\Pohoda\PrintRequest; |
||
| 13 | |||
| 14 | use Riesenia\Pohoda\AbstractAgenda; |
||
| 15 | use Riesenia\Pohoda\Common; |
||
| 16 | |||
| 17 | class PrinterSettings extends AbstractAgenda |
||
| 18 | { |
||
| 19 | /** @var string[] */ |
||
| 20 | protected array $elements = [ |
||
| 21 | 'report', |
||
| 22 | 'printer', |
||
| 23 | 'pdf', |
||
| 24 | 'parameters', |
||
| 25 | ]; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * {@inheritdoc} |
||
| 29 | */ |
||
| 30 | 3 | public function setData(array $data): parent |
|
| 31 | { |
||
| 32 | // process report |
||
| 33 | 3 | if (isset($data['report'])) { |
|
| 34 | 3 | $report = new Report($this->dependenciesFactory); |
|
| 35 | 3 | $data['report'] = $report |
|
| 36 | 3 | ->setDirectionalVariable($this->useOneDirectionalVariables) |
|
| 37 | 3 | ->setResolveOptions($this->resolveOptions) |
|
| 38 | 3 | ->setData($data['report']); |
|
| 39 | } |
||
| 40 | // process pdf |
||
| 41 | 3 | if (isset($data['pdf'])) { |
|
| 42 | 3 | $pdf = new Pdf($this->dependenciesFactory); |
|
| 43 | 3 | $data['pdf'] = $pdf |
|
| 44 | 3 | ->setDirectionalVariable($this->useOneDirectionalVariables) |
|
| 45 | 3 | ->setResolveOptions($this->resolveOptions) |
|
| 46 | 3 | ->setData($data['pdf']); |
|
| 47 | } |
||
| 48 | // process parameters |
||
| 49 | 3 | if (isset($data['parameters'])) { |
|
| 50 | 3 | $parameters = new Parameters($this->dependenciesFactory); |
|
| 51 | 3 | $data['parameters'] = $parameters |
|
| 52 | 3 | ->setDirectionalVariable($this->useOneDirectionalVariables) |
|
| 53 | 3 | ->setResolveOptions($this->resolveOptions) |
|
| 54 | 3 | ->setData($data['parameters']); |
|
| 55 | } |
||
| 56 | |||
| 57 | 3 | return parent::setData($data); |
|
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * {@inheritdoc} |
||
| 62 | */ |
||
| 63 | 2 | public function getXML(): \SimpleXMLElement |
|
| 64 | { |
||
| 65 | 2 | $xml = $this->createXML()->addChild('prn:printerSettings', '', $this->namespace('prn')); |
|
| 66 | |||
| 67 | 2 | $this->addElements($xml, $this->elements, 'prn'); |
|
| 68 | |||
| 69 | 2 | return $xml; |
|
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * {@inheritdoc} |
||
| 74 | */ |
||
| 75 | 1 | protected function configureOptions(Common\OptionsResolver $resolver): void |
|
| 76 | { |
||
| 77 | // available options |
||
| 78 | 1 | $resolver->setDefined($this->elements); |
|
| 79 | } |
||
| 80 | } |
||
| 81 |