Total Complexity | 5 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | class Parameters extends AbstractAgenda |
||
18 | { |
||
19 | /** @var string[] */ |
||
20 | protected array $elements = ['copy', 'datePrint']; |
||
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | 3 | public function setData(array $data): parent |
|
26 | { |
||
27 | 3 | $factory = new ParameterFactory($this->namespacesPaths, $this->sanitizeEncoding, $this->normalizerFactory); |
|
28 | |||
29 | 3 | foreach ($factory->getKeys() as $key) { |
|
30 | // fill elements from factory |
||
31 | 3 | $this->elements[] = $key; |
|
32 | // add instance to data |
||
33 | 3 | if (isset($data[$key])) { |
|
34 | 3 | $data[$key] = $factory->getByKey($key)->setDirectionalVariable($this->useOneDirectionalVariables)->setResolveOptions($this->resolveOptions)->setData($data[$key]); |
|
35 | } |
||
36 | } |
||
37 | |||
38 | 3 | return parent::setData($data); |
|
|
|||
39 | } |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | 2 | public function getXML(): \SimpleXMLElement |
|
45 | { |
||
46 | 2 | $xml = $this->createXML()->addChild('prn:parameters', '', $this->namespace('prn')); |
|
47 | |||
48 | 2 | $this->addElements($xml, $this->elements, 'prn'); |
|
49 | |||
50 | 2 | return $xml; |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | 1 | protected function configureOptions(Common\OptionsResolver $resolver): void |
|
63 | } |
||
64 | } |
||
65 |