Completed
Push — master ( b96d44...cf3a4a )
by Adam
03:18
created
src/Format/Xml.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
 
19 19
     public function parse()
20 20
     {
21
-        return [$this->getValue()->documentElement->tagName =>
22
-            $this->convert($this->value->documentElement)];
21
+        return [ $this->getValue()->documentElement->tagName =>
22
+            $this->convert($this->value->documentElement) ];
23 23
     }
24 24
 
25
-    public function convert($node, $output = [])
25
+    public function convert($node, $output = [ ])
26 26
     {
27 27
         switch ($node->nodeType) {
28 28
             case XML_CDATA_SECTION_NODE:
29
-                $output['@cdata'] = trim($node->textContent);
29
+                $output[ '@cdata' ] = trim($node->textContent);
30 30
                 break;
31 31
             case XML_TEXT_NODE:
32 32
                 $output = trim($node->textContent);
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
 
48 48
     private function childNode($node)
49 49
     {
50
-        foreach($node->childNodes as $child) {
50
+        foreach ($node->childNodes as $child) {
51 51
             $children = $this->convert($child);
52 52
 
53
-            if(isset($child->tagName)) {
53
+            if (isset($child->tagName)) {
54 54
                 $tagName = $child->tagName;
55
-                $output[$tagName] = isset($output[$tagName])
56
-                    ? $output[$tagName]
57
-                    : [];
55
+                $output[ $tagName ] = isset($output[ $tagName ])
56
+                    ? $output[ $tagName ]
57
+                    : [ ];
58 58
 
59
-                $output[$tagName][] = $children;
60
-            } elseif($children !== '') {
59
+                $output[ $tagName ][ ] = $children;
60
+            } elseif ($children !== '') {
61 61
                 $output = $children;
62 62
             }
63 63
         }
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
         return $output;
66 66
     }
67 67
 
68
-    private function loopAttributes($attributes, $array = [])
68
+    private function loopAttributes($attributes, $array = [ ])
69 69
     {
70 70
         // Loop through the attributes and collect them.
71
-        foreach($attributes as $key => $node) {
72
-            $array[$key] = (string) $node->value;
71
+        foreach ($attributes as $key => $node) {
72
+            $array[ $key ] = (string) $node->value;
73 73
         }
74 74
 
75 75
         return $array;
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
     private function attributes($node, $output)
79 79
     {
80 80
         // If there are attributes.
81
-        if($node->attributes->length) {
82
-            $output = is_array($output) ? $output : ['@value' => $output];
83
-            $output['@attributes'] = $this->loopAttributes($node->attributes);
81
+        if ($node->attributes->length) {
82
+            $output = is_array($output) ? $output : [ '@value' => $output ];
83
+            $output[ '@attributes' ] = $this->loopAttributes($node->attributes);
84 84
         }
85 85
 
86 86
         return $output;
87 87
     }
88 88
 
89
-    private function addChildNodes ($output)
89
+    private function addChildNodes($output)
90 90
     {
91
-        if(is_array($output)) {
91
+        if (is_array($output)) {
92 92
             foreach ($output as $key => $value) {
93
-                $output[$key] = is_array($value) && count($value) === 1
94
-                    ? $value[0]
93
+                $output[ $key ] = is_array($value) && count($value) === 1
94
+                    ? $value[ 0 ]
95 95
                     : $value;
96 96
             }
97 97
 
Please login to merge, or discard this patch.