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