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