alex-kalanis /
pohoda
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace kalanis\Pohoda; |
||
| 6 | |||
| 7 | class PrintRequest extends AbstractAgenda |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * {@inheritdoc} |
||
| 11 | */ |
||
| 12 | 3 | public function setData(Common\Dtos\AbstractDto $data): parent |
|
| 13 | { |
||
| 14 | 3 | if (!empty($data->record)) { |
|
| 15 | // process record |
||
| 16 | 3 | $record = new PrintRequest\Record($this->dependenciesFactory); |
|
| 17 | 3 | $record |
|
| 18 | 3 | ->setDirectionalVariable($this->useOneDirectionalVariables) |
|
| 19 | 3 | ->setResolveOptions($this->resolveOptions) |
|
| 20 | 3 | ->setData($data->record); |
|
| 21 | 3 | $data->record = $record; |
|
| 22 | } |
||
| 23 | |||
| 24 | 3 | if (!empty($data->printerSettings)) { |
|
| 25 | // process printer settings |
||
| 26 | 3 | $printerSettings = new PrintRequest\PrinterSettings($this->dependenciesFactory); |
|
| 27 | 3 | $printerSettings |
|
| 28 | 3 | ->setDirectionalVariable($this->useOneDirectionalVariables) |
|
| 29 | 3 | ->setResolveOptions($this->resolveOptions) |
|
| 30 | 3 | ->setData($data->printerSettings); |
|
| 31 | 3 | $data->printerSettings = $printerSettings; |
|
| 32 | } |
||
| 33 | |||
| 34 | 3 | return parent::setData($data); |
|
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * {@inheritdoc} |
||
| 39 | */ |
||
| 40 | 2 | public function getXML(): \SimpleXMLElement |
|
| 41 | { |
||
| 42 | 2 | $xml = $this->createXML()->addChild('prn:print', '', $this->namespace('prn')); |
|
| 43 | 2 | $xml->addAttribute('version', '1.0'); |
|
| 44 | |||
| 45 | 2 | $this->addElements($xml, $this->getDataElements(), 'prn'); |
|
| 46 | |||
| 47 | 2 | return $xml; |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @{inheritDoc} |
||
| 52 | */ |
||
| 53 | 3 | protected function getDefaultDto(): Common\Dtos\AbstractDto |
|
| 54 | { |
||
| 55 | 3 | return new PrintRequest\PrintRequestDto(); |
|
| 56 | } |
||
| 57 | } |
||
| 58 |