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; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @property array{ |
||
| 16 | * actionType?: Type\ActionType, |
||
| 17 | * header: AddressBook\Header, |
||
| 18 | * } $data |
||
| 19 | */ |
||
| 20 | class AddressBook extends AbstractAgenda |
||
| 21 | { |
||
| 22 | use Common\AddActionTypeTrait; |
||
| 23 | use Common\AddParameterToHeaderTrait; |
||
| 24 | |||
| 25 | 1 | public function getImportRoot(): string |
|
| 26 | { |
||
| 27 | 1 | return 'lAdb:addressbook'; |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * {@inheritdoc} |
||
| 32 | */ |
||
| 33 | 6 | public function setData(array $data): parent |
|
| 34 | { |
||
| 35 | // pass to header |
||
| 36 | 6 | if (!empty($data)) { |
|
| 37 | 6 | $header = new AddressBook\Header($this->dependenciesFactory); |
|
| 38 | 6 | $header |
|
| 39 | 6 | ->setDirectionalVariable($this->useOneDirectionalVariables) |
|
| 40 | 6 | ->setResolveOptions($this->resolveOptions) |
|
| 41 | 6 | ->setData($data); |
|
| 42 | 6 | $data = ['header' => $header]; |
|
| 43 | } |
||
| 44 | |||
| 45 | 6 | return parent::setData($data); |
|
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritdoc} |
||
| 50 | */ |
||
| 51 | 6 | public function getXML(): \SimpleXMLElement |
|
| 52 | { |
||
| 53 | 6 | $xml = $this->createXML()->addChild('adb:addressbook', '', $this->namespace('adb')); |
|
| 54 | 6 | $xml->addAttribute('version', '2.0'); |
|
| 55 | |||
| 56 | 6 | $this->addElements($xml, ['actionType', 'header'], 'adb'); |
|
| 57 | |||
| 58 | 6 | return $xml; |
|
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * {@inheritdoc} |
||
| 63 | */ |
||
| 64 | 1 | protected function configureOptions(Common\OptionsResolver $resolver): void |
|
| 65 | { |
||
| 66 | // available options |
||
| 67 | 1 | $resolver->setDefined(['header']); |
|
| 68 | } |
||
| 69 | } |
||
| 70 |