| Conditions | 6 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 17 | public function getXML(): \SimpleXMLElement |
|
| 20 | { |
||
| 21 | 17 | $xml = $this->createXML()->addChild('typ:parameter', '', $this->namespace('typ')); |
|
| 22 | |||
| 23 | 17 | $child = $this->data->name ?? null; |
|
| 24 | 17 | $xml->addChild('typ:name', is_null($child) ? null : \strval($child)); |
|
| 25 | |||
| 26 | 17 | if (Type\Enums\ParameterTypeEnum::List->value == $this->data->type) { |
|
| 27 | 13 | $this->addRefElement($xml, 'typ:listValueRef', $this->data->value); |
|
| 28 | |||
| 29 | 13 | if (!empty($this->data->list)) { |
|
| 30 | 13 | $this->addRefElement($xml, 'typ:list', $this->data->list); |
|
| 31 | } |
||
| 32 | |||
| 33 | 15 | } elseif (Type\Enums\ParameterTypeEnum::Boolean->value == $this->data->type) { |
|
| 34 | 11 | $xml->addChild('typ:' . \strval($this->data->type) . 'Value', $this->data->value ? 'true' : 'false'); |
|
| 35 | |||
| 36 | } else { |
||
| 37 | 15 | $xml->addChild('typ:' . \strval($this->data->type) . 'Value', \htmlspecialchars(\strval($this->data->value))); |
|
| 38 | } |
||
| 39 | |||
| 40 | 17 | return $xml; |
|
| 41 | } |
||
| 51 |