@@ -85,9 +85,9 @@ |
||
85 | 85 | if ($attributeName === 'title') { |
86 | 86 | $mainElement[0]=$attributeValue; |
87 | 87 | } elseif (substr($attributeName, 0, 1) === '_') { |
88 | - $mainElement->addAttribute(substr($attributeName, 1), $attributeValue); |
|
88 | + $mainElement->addAttribute(substr($attributeName, 1), $attributeValue); |
|
89 | 89 | } else { |
90 | - $mainElement->addChild($attributeName, $attributeValue); |
|
90 | + $mainElement->addChild($attributeName, $attributeValue); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 |
@@ -83,7 +83,7 @@ |
||
83 | 83 | if (empty($attributeValue)) |
84 | 84 | return; |
85 | 85 | if ($attributeName === 'title') { |
86 | - $mainElement[0]=$attributeValue; |
|
86 | + $mainElement[0] = $attributeValue; |
|
87 | 87 | } elseif (substr($attributeName, 0, 1) === '_') { |
88 | 88 | $mainElement->addAttribute(substr($attributeName, 1), $attributeValue); |
89 | 89 | } else { |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function getAsXmlObject(BaseXmlObject $object = null): SimpleXMLElement |
19 | 19 | { |
20 | - if (empty($object)) |
|
21 | - $object = $this; |
|
20 | + if (empty($object)) { |
|
21 | + $object = $this; |
|
22 | + } |
|
22 | 23 | $className = mb_strtolower((new ReflectionClass($object))->getShortName()); |
23 | 24 | $mainElement = new SimpleXMLElement("<$className></$className>"); |
24 | 25 | foreach ($object as $attributeName => $attributeValue) { |
@@ -34,8 +35,9 @@ discard block |
||
34 | 35 | */ |
35 | 36 | protected function processAttributeNameAndValue($mainElement, $attributeName, $attributeValue): void |
36 | 37 | { |
37 | - if (empty($attributeValue)) |
|
38 | - return; |
|
38 | + if (empty($attributeValue)) { |
|
39 | + return; |
|
40 | + } |
|
39 | 41 | if (is_array($attributeValue)) { |
40 | 42 | $this->addValueAsArray($mainElement, $attributeName, $attributeValue); |
41 | 43 | } elseif (is_object($attributeValue)) { |
@@ -68,8 +70,9 @@ discard block |
||
68 | 70 | protected function addValueAsObject($mainElement, $attributeValue) |
69 | 71 | { |
70 | 72 | $newXmlObject = $mainElement->addChild($attributeValue->getAsXmlObject()->getName()); |
71 | - foreach ($attributeValue->getAsXmlObject()->children() as $child) |
|
72 | - $newXmlObject->addChild($child->getName(), $child); |
|
73 | + foreach ($attributeValue->getAsXmlObject()->children() as $child) { |
|
74 | + $newXmlObject->addChild($child->getName(), $child); |
|
75 | + } |
|
73 | 76 | } |
74 | 77 | |
75 | 78 | /** |
@@ -80,8 +83,9 @@ discard block |
||
80 | 83 | */ |
81 | 84 | protected function addValueAsString(SimpleXMLElement $mainElement, $attributeName, $attributeValue):void |
82 | 85 | { |
83 | - if (empty($attributeValue)) |
|
84 | - return; |
|
86 | + if (empty($attributeValue)) { |
|
87 | + return; |
|
88 | + } |
|
85 | 89 | if ($attributeName === 'title') { |
86 | 90 | $mainElement[0]=$attributeValue; |
87 | 91 | } elseif (substr($attributeName, 0, 1) === '_') { |