alex-kalanis /
pohoda
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace kalanis\Pohoda; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * @property IntParam\IntParamDto $data |
||
| 9 | */ |
||
| 10 | class IntParam extends AbstractAgenda |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * {@inheritdoc} |
||
| 14 | */ |
||
| 15 | 3 | public function setData(Common\Dtos\AbstractDto $data): parent |
|
| 16 | { |
||
| 17 | // process settings |
||
| 18 | 3 | if (isset($data->parameterSettings)) { |
|
| 19 | // prepare empty parameter list for list |
||
| 20 | 3 | if (!empty($data->parameterType) && (Common\Enums\ParamTypeEnum::ListValue->value == $data->parameterType)) { |
|
| 21 | 1 | if (!isset($data->parameterSettings->parameterList)) { |
|
| 22 | 1 | $data->parameterSettings->parameterList = []; |
|
| 23 | } |
||
| 24 | } |
||
| 25 | |||
| 26 | 3 | $parameterSettings = new IntParam\Settings($this->dependenciesFactory); |
|
| 27 | 3 | $parameterSettings |
|
| 28 | 3 | ->setDirectionalVariable($this->useOneDirectionalVariables) |
|
| 29 | 3 | ->setResolveOptions($this->resolveOptions) |
|
| 30 | 3 | ->setData($data->parameterSettings); |
|
| 31 | 3 | $data->parameterSettings = $parameterSettings; |
|
| 32 | } |
||
| 33 | |||
| 34 | 3 | return parent::setData($data); |
|
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 35 | } |
||
| 36 | |||
| 37 | 1 | public function getImportRoot(): string |
|
| 38 | { |
||
| 39 | 1 | return 'lst:intParamDetail'; |
|
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * {@inheritdoc} |
||
| 44 | */ |
||
| 45 | 2 | public function getXML(): \SimpleXMLElement |
|
| 46 | { |
||
| 47 | 2 | $xml = $this->createXML()->addChild('ipm:intParamDetail', '', $this->namespace('ipm')); |
|
| 48 | 2 | $xml->addAttribute('version', '2.0'); |
|
| 49 | |||
| 50 | 2 | $param = $xml->addChild('ipm:intParam'); |
|
| 51 | 2 | $this->addElements($param, $this->getDataElements(), 'ipm'); |
|
| 52 | |||
| 53 | 2 | return $xml; |
|
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * {@inheritdoc} |
||
| 58 | */ |
||
| 59 | 3 | protected function getDefaultDto(): Common\Dtos\AbstractDto |
|
| 60 | { |
||
| 61 | 3 | return new IntParam\IntParamDto(); |
|
| 62 | } |
||
| 63 | } |
||
| 64 |