Completed
Branch master (ae8dd7)
by Daniele
07:55
created
source/FluidXml.php 3 patches
Doc Comments   +24 added lines, -5 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  *
69 69
  * @param array $arguments Options that influence the construction of the XML document.
70 70
  *
71
- * @return FluidXml A new FluidXml instance.
71
+ * @return FluidContext A new FluidXml instance.
72 72
  */
73 73
 function fluidify(...$arguments)
74 74
 {
@@ -85,6 +85,9 @@  discard block
 block discarded – undo
85 85
         return new FluidNamespace(...$arguments);
86 86
 }
87 87
 
88
+/**
89
+ * @param string $string
90
+ */
88 91
 function is_an_xml_string($string)
89 92
 {
90 93
         // Removes any empty new line at the beginning,
@@ -143,12 +146,16 @@  discard block
 block discarded – undo
143 146
          * $xml->query("/doc")->query("book[@id='123']");
144 147
          * ```
145 148
          *
146
-         * @param string $xpath The XPath to execute.
149
+         * @param string[] $xpath The XPath to execute.
147 150
          *
148 151
          * @return FluidContext The context associated to the DOMNodeList.
149 152
          */
150 153
         public function query(...$xpath);
151 154
         public function times($times, callable $fn = null);
155
+
156
+        /**
157
+         * @return FluidContext
158
+         */
152 159
         public function each(callable $fn);
153 160
 
154 161
         /**
@@ -165,9 +172,6 @@  discard block
 block discarded – undo
165 172
          * ```
166 173
          *
167 174
          * @param string|array $child The child/children to add.
168
-         * @param string $value The child text content.
169
-         * @param bool $switchContext Whether to return the current context
170
-         *                            or the context of the created node.
171 175
          *
172 176
          * @return FluidContext The context associated to the DOMNodeList.
173 177
          */
@@ -182,6 +186,10 @@  discard block
 block discarded – undo
182 186
         public function remove(...$xpath);
183 187
         public function xml($strip = false);
184 188
         // Aliases:
189
+
190
+        /**
191
+         * @return FluidContext
192
+         */
185 193
         public function add($child, ...$optionals);
186 194
         public function prepend($sibling, ...$optionals);
187 195
         public function insertSiblingBefore($sibling, ...$optionals);
@@ -478,6 +486,10 @@  discard block
 block discarded – undo
478 486
                 return new FluidContext($context, $this->namespaces);
479 487
         }
480 488
 
489
+        /**
490
+         * @param FluidContext $helpContext
491
+         * @param FluidContext $newContext
492
+         */
481 493
         protected function chooseContext($helpContext, $newContext)
482 494
         {
483 495
                 // If the two contextes are diffent, the user has requested
@@ -876,6 +888,10 @@  discard block
 block discarded – undo
876 888
                 return new FluidContext($context, $this->namespaces);
877 889
         }
878 890
 
891
+        /**
892
+         * @param string $name
893
+         * @param string $value
894
+         */
879 895
         protected function createElement($name, $value = null)
880 896
         {
881 897
                 // The DOMElement instance must be different for every node,
@@ -1211,6 +1227,9 @@  discard block
 block discarded – undo
1211 1227
         protected $context;
1212 1228
         protected $times;
1213 1229
 
1230
+        /**
1231
+         * @param FluidContext $context
1232
+         */
1214 1233
         public function __construct($context, $times)
1215 1234
         {
1216 1235
                 $this->context = $context;
Please login to merge, or discard this patch.
Indentation   +11 added lines, -13 removed lines patch added patch discarded remove patch
@@ -136,7 +136,6 @@  discard block
 block discarded – undo
136 136
          *
137 137
          * ```php
138 138
          * $xml = fluidxml();
139
-
140 139
          * $xml->query("/doc/book[@id='123']");
141 140
          *
142 141
          * // Relative queries are valid.
@@ -156,7 +155,6 @@  discard block
 block discarded – undo
156 155
          *
157 156
          * ```php
158 157
          * $xml = fluidxml();
159
-
160 158
          * $xml->appendChild('title', 'The Theory Of Everything');
161 159
          * $xml->appendChild([ 'author' => 'S. Hawking' ]);
162 160
          *
@@ -234,8 +232,8 @@  discard block
 block discarded – undo
234 232
 class FluidXml implements FluidInterface
235 233
 {
236 234
         use FluidNamespaceTrait,
237
-            FluidXmlShadowTrait,        // For compatibility with PHP 5.6.
238
-            FluidContextShadowTrait;    // For compatibility with PHP 5.6.
235
+                FluidXmlShadowTrait,        // For compatibility with PHP 5.6.
236
+                FluidContextShadowTrait;    // For compatibility with PHP 5.6.
239 237
 
240 238
         const ROOT_NODE = 'doc';
241 239
 
@@ -266,9 +264,9 @@  discard block
 block discarded – undo
266 264
         public function __construct($root = null, $options = [])
267 265
         {
268 266
                 $defaults = [ 'root'       => self::ROOT_NODE,
269
-                              'version'    => '1.0',
270
-                              'encoding'   => 'UTF-8',
271
-                              'stylesheet' => null ];
267
+                                'version'    => '1.0',
268
+                                'encoding'   => 'UTF-8',
269
+                                'stylesheet' => null ];
272 270
 
273 271
                 if (\is_string($root)) {
274 272
                         // The root option can be specified as first argument
@@ -292,9 +290,9 @@  discard block
 block discarded – undo
292 290
 
293 291
                 if ($opts['stylesheet']) {
294 292
                         $attrs = "type=\"text/xsl\" "
295
-                               . "encoding=\"{$opts['encoding']}\" "
296
-                               . "indent=\"yes\" "
297
-                               . "href=\"{$opts['stylesheet']}\"";
293
+                                . "encoding=\"{$opts['encoding']}\" "
294
+                                . "indent=\"yes\" "
295
+                                . "href=\"{$opts['stylesheet']}\"";
298 296
                         $stylesheet = new \DOMProcessingInstruction('xml-stylesheet', $attrs);
299 297
 
300 298
                         $this->dom->insertBefore($stylesheet, $this->dom->documentElement);
@@ -493,7 +491,7 @@  discard block
 block discarded – undo
493 491
 class FluidContext implements FluidInterface, \ArrayAccess, \Iterator
494 492
 {
495 493
         use FluidNamespaceTrait,
496
-            FluidContextShadowTrait;    // For compatibility with PHP 5.6.
494
+                FluidContextShadowTrait;    // For compatibility with PHP 5.6.
497 495
 
498 496
         private $dom;
499 497
         private $nodes = [];
@@ -1142,8 +1140,8 @@  discard block
 block discarded – undo
1142 1140
         const MODE_EXPLICIT = 1;
1143 1141
 
1144 1142
         private $config = [ self::ID   => '',
1145
-                            self::URI  => '',
1146
-                            self::MODE => self::MODE_EXPLICIT ];
1143
+                                self::URI  => '',
1144
+                                self::MODE => self::MODE_EXPLICIT ];
1147 1145
 
1148 1146
         public function __construct($id, $uri, $mode = 1)
1149 1147
         {
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                 $namespaces = [];
211 211
 
212 212
                 if (\is_string($arguments[0])) {
213
-                        $args = [ $arguments[0], $arguments[1] ];
213
+                        $args = [$arguments[0], $arguments[1]];
214 214
 
215 215
                         if (isset($arguments[2])) {
216 216
                                 $args[] = $arguments[2];
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 class FluidXml implements FluidInterface
235 235
 {
236 236
         use FluidNamespaceTrait,
237
-            FluidXmlShadowTrait,        // For compatibility with PHP 5.6.
238
-            FluidContextShadowTrait;    // For compatibility with PHP 5.6.
237
+            FluidXmlShadowTrait, // For compatibility with PHP 5.6.
238
+            FluidContextShadowTrait; // For compatibility with PHP 5.6.
239 239
 
240 240
         const ROOT_NODE = 'doc';
241 241
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
         public static function load($document)
245 245
         {
246
-                if (\is_string($document) && ! \FluidXml\is_an_xml_string($document)) {
246
+                if (\is_string($document) && !\FluidXml\is_an_xml_string($document)) {
247 247
                         // Removes any empty new line at the beginning,
248 248
                         // otherwise the first character check fails.
249 249
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
                                 $document = \file_get_contents($file);
256 256
                         }
257 257
 
258
-                        if (! $is_file || ! $is_readable || ! $document) {
258
+                        if (!$is_file || !$is_readable || !$document) {
259 259
                                 throw new \Exception("File '$file' not accessible.");
260 260
                         }
261 261
                 }
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 
266 266
         public function __construct($root = null, $options = [])
267 267
         {
268
-                $defaults = [ 'root'       => self::ROOT_NODE,
268
+                $defaults = ['root'       => self::ROOT_NODE,
269 269
                               'version'    => '1.0',
270 270
                               'encoding'   => 'UTF-8',
271
-                              'stylesheet' => null ];
271
+                              'stylesheet' => null];
272 272
 
273 273
                 if (\is_string($root)) {
274 274
                         // The root option can be specified as first argument
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
 
463 463
         protected function newContext($context = null)
464 464
         {
465
-                if (! $context) {
465
+                if (!$context) {
466 466
                         $context = $this->dom->documentElement;
467 467
                 }
468 468
 
469 469
                 // If the user has requested ['root' => null] at construction time
470 470
                 // the 'documentElement' property is null because we have not created
471 471
                 // a root node yet.
472
-                if (! $context) {
472
+                if (!$context) {
473 473
                         // Whether there is not a root node, the DOMDocument is
474 474
                         // promoted as root node.
475 475
                         $context = $this->dom;
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 class FluidContext implements FluidInterface, \ArrayAccess, \Iterator
494 494
 {
495 495
         use FluidNamespaceTrait,
496
-            FluidContextShadowTrait;    // For compatibility with PHP 5.6.
496
+            FluidContextShadowTrait; // For compatibility with PHP 5.6.
497 497
 
498 498
         private $dom;
499 499
         private $nodes = [];
@@ -501,8 +501,8 @@  discard block
 block discarded – undo
501 501
 
502 502
         public function __construct($context, array $namespaces = [])
503 503
         {
504
-                if (! \is_array($context)) {
505
-                        $context = [ $context ];
504
+                if (!\is_array($context)) {
505
+                        $context = [$context];
506 506
                 }
507 507
 
508 508
                 foreach ($context as $n) {
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
                         }
524 524
                 }
525 525
 
526
-                if (! empty($namespaces)) {
526
+                if (!empty($namespaces)) {
527 527
                         $this->namespace(...\array_values($namespaces));
528 528
                 }
529 529
         }
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
                                 }
653 653
                         }
654 654
 
655
-                        if (! $found) {
655
+                        if (!$found) {
656 656
                                 $unique_results[] = $r;
657 657
                         }
658 658
                 }
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
                 // the user has passed two arguments:
755 755
                 // 1. is the attribute name
756 756
                 // 2. is the attribute value
757
-                if (! \is_array($arguments[0])) {
757
+                if (!\is_array($arguments[0])) {
758 758
                         $attrs = [$arguments[0] => $arguments[1]];
759 759
                 }
760 760
 
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
 
939 939
                                 return [];
940 940
                         } else {
941
-                                return [ $fn($parent, $this->createElement($k, $v)) ];
941
+                                return [$fn($parent, $this->createElement($k, $v))];
942 942
                         }
943 943
                 }
944 944
 
945
-                $v_isnt_string = ! $v_is_string;
945
+                $v_isnt_string = !$v_is_string;
946 946
 
947 947
                 if ($k_is_string && $v_isnt_string) {
948 948
                         // The user has passed one of these two cases:
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
                         // they are supplied, so 'appendChild' is the perfect operation.
956 956
                         $this->newContext($el)->appendChild($v, ...$optionals);
957 957
 
958
-                        return [ $el ];
958
+                        return [$el];
959 959
                 }
960 960
 
961 961
                 $k_is_int   = \is_int($k);
@@ -977,13 +977,13 @@  discard block
 block discarded – undo
977 977
                 }
978 978
 
979 979
                 $v_is_xml   = $v_is_string && is_an_xml_string($v);
980
-                $v_isnt_xml = ! $v_is_xml;
980
+                $v_isnt_xml = !$v_is_xml;
981 981
 
982 982
                 if ($k_is_int && $v_is_string && $v_isnt_xml) {
983 983
                         // The user has passed a node name without a node value:
984 984
                         // [ 'element', ... ]
985 985
 
986
-                        return [ $fn($parent, $this->createElement($v)) ];
986
+                        return [$fn($parent, $this->createElement($v))];
987 987
                 }
988 988
 
989 989
                 // The user has passed an XML document instance:
@@ -1046,19 +1046,19 @@  discard block
 block discarded – undo
1046 1046
                 $v_is_domnode = $v instanceof \DOMNode;
1047 1047
 
1048 1048
                 if ($k_is_int && $v_is_domnode) {
1049
-                        return $attach_nodes([ $v ]);
1049
+                        return $attach_nodes([$v]);
1050 1050
                 }
1051 1051
 
1052 1052
                 $v_is_simplexml = $v instanceof \SimpleXMLElement;
1053 1053
 
1054 1054
                 if ($k_is_int && $v_is_simplexml) {
1055
-                        return $attach_nodes([ dom_import_simplexml($v) ]);
1055
+                        return $attach_nodes([dom_import_simplexml($v)]);
1056 1056
                 }
1057 1057
 
1058 1058
                 $v_is_fluidxml = $v instanceof FluidXml;
1059 1059
 
1060 1060
                 if ($k_is_int && $v_is_fluidxml) {
1061
-                        return $attach_nodes([ $v->dom()->documentElement ]);
1061
+                        return $attach_nodes([$v->dom()->documentElement]);
1062 1062
                 }
1063 1063
 
1064 1064
                 $v_is_fluidcontext = $v instanceof FluidContext;
@@ -1080,8 +1080,8 @@  discard block
 block discarded – undo
1080 1080
 
1081 1081
         protected function insertElement(\Closure $fn, $element, ...$optionals)
1082 1082
         {
1083
-                if (! \is_array($element)) {
1084
-                        $element = [ $element ];
1083
+                if (!\is_array($element)) {
1084
+                        $element = [$element];
1085 1085
                 }
1086 1086
 
1087 1087
                 $switchContext = false;
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
                         if (\is_array($opt)) {
1092 1092
                                 $attributes = $opt;
1093 1093
 
1094
-                        } else if (\is_bool($opt)){
1094
+                        } else if (\is_bool($opt)) {
1095 1095
                                 $switchContext = $opt;
1096 1096
 
1097 1097
                         } else if (\is_string($opt)) {
@@ -1134,16 +1134,16 @@  discard block
 block discarded – undo
1134 1134
 
1135 1135
 class FluidNamespace
1136 1136
 {
1137
-        const ID   = 'id'  ;
1138
-        const URI  = 'uri' ;
1137
+        const ID   = 'id';
1138
+        const URI  = 'uri';
1139 1139
         const MODE = 'mode';
1140 1140
 
1141 1141
         const MODE_IMPLICIT = 0;
1142 1142
         const MODE_EXPLICIT = 1;
1143 1143
 
1144
-        private $config = [ self::ID   => '',
1144
+        private $config = [self::ID   => '',
1145 1145
                             self::URI  => '',
1146
-                            self::MODE => self::MODE_EXPLICIT ];
1146
+                            self::MODE => self::MODE_EXPLICIT];
1147 1147
 
1148 1148
         public function __construct($id, $uri, $mode = 1)
1149 1149
         {
Please login to merge, or discard this patch.
support/Codevelox.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -61,6 +61,9 @@
 block discarded – undo
61 61
                 return $results;
62 62
         }
63 63
 
64
+        /**
65
+         * @param integer $index
66
+         */
64 67
         public function message($index, $desc, $time)
65 68
         {
66 69
                 return "Task {$index} took $time ($desc)\n";
Please login to merge, or discard this patch.
specs/FluidXml.php 2 patches
Indentation   +329 added lines, -329 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
                 \assert($actual === $expected, __($actual, $expected));
26 26
 
27 27
                 $options = [ 'root'       => 'root',
28
-                             'version'    => '1.2',
29
-                             'encoding'   => 'UTF-16',
30
-                             'stylesheet' => 'stylesheet.xsl' ];
28
+                                'version'    => '1.2',
29
+                                'encoding'   => 'UTF-16',
30
+                                'stylesheet' => 'stylesheet.xsl' ];
31 31
 
32 32
                 $xml   = new FluidXml($options);
33 33
                 $alias = fluidxml($options);
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 describe('FluidXml', function() {
154 154
         describe(':load', function() {
155 155
                 $doc = "<root>\n"
156
-                     . "  <parent>content</parent>\n"
157
-                     . "</root>";
156
+                        . "  <parent>content</parent>\n"
157
+                        . "</root>";
158 158
                 $dom = new \DOMDocument();
159 159
                 $dom->loadXML($doc);
160 160
 
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
                         \assert($actual === $expected, __($actual, $expected));
266 266
 
267 267
                         $options = [ 'root'       => 'root',
268
-                                     'version'    => '1.2',
269
-                                     'encoding'   => 'UTF-16',
270
-                                     'stylesheet' => 'stylesheet.xsl' ];
268
+                                        'version'    => '1.2',
269
+                                        'encoding'   => 'UTF-16',
270
+                                        'stylesheet' => 'stylesheet.xsl' ];
271 271
 
272 272
                         $xml   = new FluidXml($options);
273 273
                         eval('$alias = \FluidXml\FluidXml::new($options);');
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
 
282 282
         describe('()', function() {
283 283
                 $stylesheet = "<?xml-stylesheet type=\"text/xsl\" "
284
-                                              . "encoding=\"UTF-8\" "
285
-                                              . "indent=\"yes\" "
286
-                                              . "href=\"http://servo-php.org/fluidxml\"?>";
284
+                                                . "encoding=\"UTF-8\" "
285
+                                                . "indent=\"yes\" "
286
+                                                . "href=\"http://servo-php.org/fluidxml\"?>";
287 287
 
288 288
                 it('should be an UTF-8 XML-1.0 document with one default root element', function() {
289 289
                         $xml = new FluidXml();
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                         $xml = new FluidXml(['stylesheet' => 'http://servo-php.org/fluidxml']);
316 316
 
317 317
                         $expected = $stylesheet . "\n"
318
-                                  . "<doc/>";
318
+                                        . "<doc/>";
319 319
                         assert_equal_xml($xml, $expected);
320 320
                 });
321 321
 
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
                         $x_ns  = new FluidNamespace('x', 'x.com');
368 368
                         $xx_ns = fluidns('xx', 'xx.com', FluidNamespace::MODE_IMPLICIT);
369 369
                         $nss = $xml->namespace($x_ns)
370
-                                   ->namespace($xx_ns)
371
-                                   ->namespaces();
370
+                                        ->namespace($xx_ns)
371
+                                        ->namespaces();
372 372
 
373 373
                         $actual   = $nss[$x_ns->id()];
374 374
                         $expected = $x_ns;
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
                         $xml = new FluidXml();
384 384
 
385 385
                         $nss = $xml->namespace('x', 'x.com')
386
-                                   ->namespace('xx', 'xx.com', FluidNamespace::MODE_IMPLICIT)
387
-                                   ->namespaces();
386
+                                        ->namespace('xx', 'xx.com', FluidNamespace::MODE_IMPLICIT)
387
+                                        ->namespaces();
388 388
 
389 389
                         $actual   = $nss['x']->uri();
390 390
                         $expected = 'x.com';
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
                         $xx_ns = fluidns('xx', 'xx.com', FluidNamespace::MODE_IMPLICIT);
410 410
 
411 411
                         $nss = $xml->namespace($x_ns, $xx_ns)
412
-                                   ->namespaces();
412
+                                        ->namespaces();
413 413
 
414 414
                         $actual   = $nss[$x_ns->id()];
415 415
                         $expected = $x_ns;
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
                         $xx_ns = fluidns('xx', 'xx.com', FluidNamespace::MODE_IMPLICIT);
427 427
 
428 428
                         $nss = $xml->namespace([ $x_ns, $xx_ns ])
429
-                                   ->namespaces();
429
+                                        ->namespaces();
430 430
 
431 431
                         $actual   = $nss[$x_ns->id()];
432 432
                         $expected = $x_ns;
@@ -467,60 +467,60 @@  discard block
 block discarded – undo
467 467
                 it('should accept an array of queries', function() {
468 468
                         $xml = new FluidXml();
469 469
                         $xml->appendChild('html', true)
470
-                            ->appendChild(['head','body']);
470
+                                ->appendChild(['head','body']);
471 471
                         $xml->query(['//html', '//head', '//body'])
472
-                            ->setAttribute('lang', 'en');
472
+                                ->setAttribute('lang', 'en');
473 473
 
474 474
                         $expected = "<doc>\n"
475
-                                  . "  <html lang=\"en\">\n"
476
-                                  . "    <head lang=\"en\"/>\n"
477
-                                  . "    <body lang=\"en\"/>\n"
478
-                                  . "  </html>\n"
479
-                                  . "</doc>";
475
+                                        . "  <html lang=\"en\">\n"
476
+                                        . "    <head lang=\"en\"/>\n"
477
+                                        . "    <body lang=\"en\"/>\n"
478
+                                        . "  </html>\n"
479
+                                        . "</doc>";
480 480
                         assert_equal_xml($xml, $expected);
481 481
 
482 482
                         $xml = new FluidXml();
483 483
                         $xml->appendChild('html', true)
484
-                            ->appendChild(['head','body'])
485
-                            ->query(['.', 'head', 'body'])
486
-                            ->setAttribute('lang', 'en');
484
+                                ->appendChild(['head','body'])
485
+                                ->query(['.', 'head', 'body'])
486
+                                ->setAttribute('lang', 'en');
487 487
 
488 488
                         $expected = "<doc>\n"
489
-                                  . "  <html lang=\"en\">\n"
490
-                                  . "    <head lang=\"en\"/>\n"
491
-                                  . "    <body lang=\"en\"/>\n"
492
-                                  . "  </html>\n"
493
-                                  . "</doc>";
489
+                                        . "  <html lang=\"en\">\n"
490
+                                        . "    <head lang=\"en\"/>\n"
491
+                                        . "    <body lang=\"en\"/>\n"
492
+                                        . "  </html>\n"
493
+                                        . "</doc>";
494 494
                         assert_equal_xml($xml, $expected);
495 495
                 });
496 496
 
497 497
                 it('should accept variable queries arguments', function() {
498 498
                         $xml = new FluidXml();
499 499
                         $xml->appendChild('html', true)
500
-                            ->appendChild(['head','body']);
500
+                                ->appendChild(['head','body']);
501 501
                         $xml->query('//html', '//head', '//body')
502
-                            ->setAttribute('lang', 'en');
502
+                                ->setAttribute('lang', 'en');
503 503
 
504 504
                         $expected = "<doc>\n"
505
-                                  . "  <html lang=\"en\">\n"
506
-                                  . "    <head lang=\"en\"/>\n"
507
-                                  . "    <body lang=\"en\"/>\n"
508
-                                  . "  </html>\n"
509
-                                  . "</doc>";
505
+                                        . "  <html lang=\"en\">\n"
506
+                                        . "    <head lang=\"en\"/>\n"
507
+                                        . "    <body lang=\"en\"/>\n"
508
+                                        . "  </html>\n"
509
+                                        . "</doc>";
510 510
                         assert_equal_xml($xml, $expected);
511 511
 
512 512
                         $xml = new FluidXml();
513 513
                         $xml->appendChild('html', true)
514
-                            ->appendChild(['head','body'])
515
-                            ->query('.', 'head', 'body')
516
-                            ->setAttribute('lang', 'en');
514
+                                ->appendChild(['head','body'])
515
+                                ->query('.', 'head', 'body')
516
+                                ->setAttribute('lang', 'en');
517 517
 
518 518
                         $expected = "<doc>\n"
519
-                                  . "  <html lang=\"en\">\n"
520
-                                  . "    <head lang=\"en\"/>\n"
521
-                                  . "    <body lang=\"en\"/>\n"
522
-                                  . "  </html>\n"
523
-                                  . "</doc>";
519
+                                        . "  <html lang=\"en\">\n"
520
+                                        . "    <head lang=\"en\"/>\n"
521
+                                        . "    <body lang=\"en\"/>\n"
522
+                                        . "  </html>\n"
523
+                                        . "</doc>";
524 524
                         assert_equal_xml($xml, $expected);
525 525
                 });
526 526
 
@@ -548,10 +548,10 @@  discard block
 block discarded – undo
548 548
                         // XPATH: //child/subchild //child
549 549
                         $xml = new FluidXml();
550 550
                         $xml->appendChild('html', true)
551
-                            ->appendChild(['head','body']);
551
+                                ->appendChild(['head','body']);
552 552
                         $cx = $xml->query('/doc/html/body')
553
-                                  ->appendChild('h1')
554
-                                  ->query('/doc/html/head');
553
+                                        ->appendChild('h1')
554
+                                        ->query('/doc/html/head');
555 555
 
556 556
                         $actual   = $cx[0]->nodeName;
557 557
                         $expected = 'head';
@@ -562,21 +562,21 @@  discard block
 block discarded – undo
562 562
                         // XPATH: //child/subchild ../..
563 563
                         $xml = new FluidXml();
564 564
                         $xml->appendChild('html', true)
565
-                            ->appendChild(['head','body'], true)
566
-                            ->query('../body')
567
-                            ->appendChild('h1')
568
-                            ->query('../..')
569
-                            ->appendChild('extra');
565
+                                ->appendChild(['head','body'], true)
566
+                                ->query('../body')
567
+                                ->appendChild('h1')
568
+                                ->query('../..')
569
+                                ->appendChild('extra');
570 570
 
571 571
                         $expected = "<doc>\n"
572
-                                  . "  <html>\n"
573
-                                  . "    <head/>\n"
574
-                                  . "    <body>\n"
575
-                                  . "      <h1/>\n"
576
-                                  . "    </body>\n"
577
-                                  . "  </html>\n"
578
-                                  . "  <extra/>\n"
579
-                                  . "</doc>";
572
+                                        . "  <html>\n"
573
+                                        . "    <head/>\n"
574
+                                        . "    <body>\n"
575
+                                        . "      <h1/>\n"
576
+                                        . "    </body>\n"
577
+                                        . "  </html>\n"
578
+                                        . "  <extra/>\n"
579
+                                        . "</doc>";
580 580
                         assert_equal_xml($xml, $expected);
581 581
                 });
582 582
 
@@ -588,12 +588,12 @@  discard block
 block discarded – undo
588 588
                         $xml->namespace($x_ns, $xx_ns);
589 589
 
590 590
                         $xml->appendChild('x:a',  true)
591
-                            ->appendChild('x:b',  true)
592
-                            ->appendChild('xx:c', true)
593
-                            ->appendChild('xx:d', true)
594
-                            ->appendChild('e',    true)
595
-                            ->appendChild('x:f',  true)
596
-                            ->appendChild('g');
591
+                                ->appendChild('x:b',  true)
592
+                                ->appendChild('xx:c', true)
593
+                                ->appendChild('xx:d', true)
594
+                                ->appendChild('e',    true)
595
+                                ->appendChild('x:f',  true)
596
+                                ->appendChild('g');
597 597
 
598 598
                         $r = $xml->query('/doc/a');
599 599
 
@@ -674,12 +674,12 @@  discard block
 block discarded – undo
674 674
                         });
675 675
 
676 676
                         $xml->appendChild('child1')
677
-                            ->appendChild('child2');
677
+                                ->appendChild('child2');
678 678
 
679 679
                         $nodes = [];
680 680
                         $index = 0;
681 681
                         $xml->query('/doc/*')
682
-                            ->each(function($cx, $n, $i) use (&$nodes, &$index) {
682
+                                ->each(function($cx, $n, $i) use (&$nodes, &$index) {
683 683
                                 $cx->setText($n->nodeName);
684 684
                                 $nodes[] = $n;
685 685
 
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
                         \assert($actual === $expected, __($actual, $expected));
696 696
 
697 697
                         $expected = "<doc>\n"
698
-                                  . "  <child1>child1</child1>\n"
699
-                                  . "  <child2>child2</child2>\n"
700
-                                  . "</doc>";
698
+                                        . "  <child1>child1</child1>\n"
699
+                                        . "  <child2>child2</child2>\n"
700
+                                        . "</doc>";
701 701
                         assert_equal_xml($xml, $expected);
702 702
                 });
703 703
         });
@@ -713,13 +713,13 @@  discard block
 block discarded – undo
713 713
 
714 714
                         $xml->times(2)
715 715
                                 ->add('child')
716
-                            ->add('lastchild');
716
+                                ->add('lastchild');
717 717
 
718 718
                         $expected = "<doc>\n"
719
-                                  . "  <child/>\n"
720
-                                  . "  <child/>\n"
721
-                                  . "  <lastchild/>\n"
722
-                                  . "</doc>";
719
+                                        . "  <child/>\n"
720
+                                        . "  <child/>\n"
721
+                                        . "  <lastchild/>\n"
722
+                                        . "</doc>";
723 723
                         assert_equal_xml($xml, $expected);
724 724
                 });
725 725
 
@@ -731,13 +731,13 @@  discard block
 block discarded – undo
731 731
                                         ->add('subchild');
732 732
 
733 733
                         $expected = "<doc>\n"
734
-                                  . "  <child>\n"
735
-                                  . "    <subchild/>\n"
736
-                                  . "  </child>\n"
737
-                                  . "  <child>\n"
738
-                                  . "    <subchild/>\n"
739
-                                  . "  </child>\n"
740
-                                  . "</doc>";
734
+                                        . "  <child>\n"
735
+                                        . "    <subchild/>\n"
736
+                                        . "  </child>\n"
737
+                                        . "  <child>\n"
738
+                                        . "    <subchild/>\n"
739
+                                        . "  </child>\n"
740
+                                        . "</doc>";
741 741
                         assert_equal_xml($xml, $expected);
742 742
                 });
743 743
 
@@ -752,14 +752,14 @@  discard block
 block discarded – undo
752 752
                                 ->add('lastchild');
753 753
 
754 754
                         $expected = "<doc>\n"
755
-                                  . "  <parent>\n"
756
-                                  . "    <child0/>\n"
757
-                                  . "    <sep/>\n"
758
-                                  . "    <child1/>\n"
759
-                                  . "    <sep/>\n"
760
-                                  . "    <lastchild/>\n"
761
-                                  . "  </parent>\n"
762
-                                  . "</doc>";
755
+                                        . "  <parent>\n"
756
+                                        . "    <child0/>\n"
757
+                                        . "    <sep/>\n"
758
+                                        . "    <child1/>\n"
759
+                                        . "    <sep/>\n"
760
+                                        . "    <lastchild/>\n"
761
+                                        . "  </parent>\n"
762
+                                        . "</doc>";
763 763
                         assert_equal_xml($xml, $expected);
764 764
                 });
765 765
         });
@@ -772,46 +772,46 @@  discard block
 block discarded – undo
772 772
                 it('should add a child', function() {
773 773
                         $xml = new FluidXml();
774 774
                         $xml->appendChild('child1')
775
-                            ->appendChild('child2')
776
-                            ->appendChild('parent', true)
777
-                            ->appendChild('child3')
778
-                            ->appendChild('child4');
775
+                                ->appendChild('child2')
776
+                                ->appendChild('parent', true)
777
+                                ->appendChild('child3')
778
+                                ->appendChild('child4');
779 779
 
780 780
                         $expected = "<doc>\n"
781
-                                  . "  <child1/>\n"
782
-                                  . "  <child2/>\n"
783
-                                  . "  <parent>\n"
784
-                                  . "    <child3/>\n"
785
-                                  . "    <child4/>\n"
786
-                                  . "  </parent>\n"
787
-                                  . "</doc>";
781
+                                        . "  <child1/>\n"
782
+                                        . "  <child2/>\n"
783
+                                        . "  <parent>\n"
784
+                                        . "    <child3/>\n"
785
+                                        . "    <child4/>\n"
786
+                                        . "  </parent>\n"
787
+                                        . "</doc>";
788 788
                         assert_equal_xml($xml, $expected);
789 789
                 });
790 790
 
791 791
                 it('should add many children', function() {
792 792
                         $xml = new FluidXml();
793 793
                         $xml->appendChild(['child1', 'child2'])
794
-                            ->appendChild('parent', true)
795
-                            ->appendChild(['child3', 'child4']);
794
+                                ->appendChild('parent', true)
795
+                                ->appendChild(['child3', 'child4']);
796 796
 
797 797
                         $expected = "<doc>\n"
798
-                                  . "  <child1/>\n"
799
-                                  . "  <child2/>\n"
800
-                                  . "  <parent>\n"
801
-                                  . "    <child3/>\n"
802
-                                  . "    <child4/>\n"
803
-                                  . "  </parent>\n"
804
-                                  . "</doc>";
798
+                                        . "  <child1/>\n"
799
+                                        . "  <child2/>\n"
800
+                                        . "  <parent>\n"
801
+                                        . "    <child3/>\n"
802
+                                        . "    <child4/>\n"
803
+                                        . "  </parent>\n"
804
+                                        . "</doc>";
805 805
                         assert_equal_xml($xml, $expected);
806 806
                 });
807 807
 
808 808
                 it('should add many children recursively', function() {
809 809
                         $xml = new FluidXml();
810 810
                         $xml->appendChild(['child1'=>['child11'=>['child111', 'child112'=>'value112'], 'child12'=>'value12'],
811
-                                           'child2'=>['child21', 'child22'=>['child221', 'child222']]])
812
-                            ->appendChild('parent', true)
813
-                            ->appendChild(['child3'=>['child31'=>['child311', 'child312'=>'value312'], 'child32'=>'value32'],
814
-                                           'child4'=>['child41', 'child42'=>['child421', 'child422']]]);
811
+                                                'child2'=>['child21', 'child22'=>['child221', 'child222']]])
812
+                                ->appendChild('parent', true)
813
+                                ->appendChild(['child3'=>['child31'=>['child311', 'child312'=>'value312'], 'child32'=>'value32'],
814
+                                                'child4'=>['child41', 'child42'=>['child421', 'child422']]]);
815 815
 
816 816
                         $expected = <<<EOF
817 817
 <doc>
@@ -854,106 +854,106 @@  discard block
 block discarded – undo
854 854
                 it('should add a child with a value', function() {
855 855
                         $xml = new FluidXml();
856 856
                         $xml->appendChild(['child1' => 'value1'])
857
-                            ->appendChild('child2', 'value2')
858
-                            ->appendChild('parent', true)
859
-                            ->appendChild(['child3' => 'value3'])
860
-                            ->appendChild('child4', 'value4');
857
+                                ->appendChild('child2', 'value2')
858
+                                ->appendChild('parent', true)
859
+                                ->appendChild(['child3' => 'value3'])
860
+                                ->appendChild('child4', 'value4');
861 861
 
862 862
                         $expected = "<doc>\n"
863
-                                  . "  <child1>value1</child1>\n"
864
-                                  . "  <child2>value2</child2>\n"
865
-                                  . "  <parent>\n"
866
-                                  . "    <child3>value3</child3>\n"
867
-                                  . "    <child4>value4</child4>\n"
868
-                                  . "  </parent>\n"
869
-                                  . "</doc>";
863
+                                        . "  <child1>value1</child1>\n"
864
+                                        . "  <child2>value2</child2>\n"
865
+                                        . "  <parent>\n"
866
+                                        . "    <child3>value3</child3>\n"
867
+                                        . "    <child4>value4</child4>\n"
868
+                                        . "  </parent>\n"
869
+                                        . "</doc>";
870 870
                         assert_equal_xml($xml, $expected);
871 871
                 });
872 872
 
873 873
                 it('should add many children with a value', function() {
874 874
                         $xml = new FluidXml();
875 875
                         $xml->appendChild(['child1' => 'value1', 'child2' => 'value2'])
876
-                             ->appendChild('parent', true)
877
-                             ->appendChild(['child3' => 'value3', 'child4' => 'value4']);
876
+                                ->appendChild('parent', true)
877
+                                ->appendChild(['child3' => 'value3', 'child4' => 'value4']);
878 878
 
879 879
                         $expected = "<doc>\n"
880
-                                  . "  <child1>value1</child1>\n"
881
-                                  . "  <child2>value2</child2>\n"
882
-                                  . "  <parent>\n"
883
-                                  . "    <child3>value3</child3>\n"
884
-                                  . "    <child4>value4</child4>\n"
885
-                                  . "  </parent>\n"
886
-                                  . "</doc>";
880
+                                        . "  <child1>value1</child1>\n"
881
+                                        . "  <child2>value2</child2>\n"
882
+                                        . "  <parent>\n"
883
+                                        . "    <child3>value3</child3>\n"
884
+                                        . "    <child4>value4</child4>\n"
885
+                                        . "  </parent>\n"
886
+                                        . "</doc>";
887 887
                         assert_equal_xml($xml, $expected);
888 888
 
889 889
                         $xml = new FluidXml();
890 890
                         $xml->appendChild([ 'child', ['child'], ['child' => 'value1'], ['child' => 'value2'] ])
891
-                             ->appendChild('parent', true)
892
-                             ->appendChild([ 'child', ['child'], ['child' => 'value3'], ['child' => 'value4'] ]);
891
+                                ->appendChild('parent', true)
892
+                                ->appendChild([ 'child', ['child'], ['child' => 'value3'], ['child' => 'value4'] ]);
893 893
 
894 894
                         $expected = "<doc>\n"
895
-                                  . "  <child/>\n"
896
-                                  . "  <child/>\n"
897
-                                  . "  <child>value1</child>\n"
898
-                                  . "  <child>value2</child>\n"
899
-                                  . "  <parent>\n"
900
-                                  . "    <child/>\n"
901
-                                  . "    <child/>\n"
902
-                                  . "    <child>value3</child>\n"
903
-                                  . "    <child>value4</child>\n"
904
-                                  . "  </parent>\n"
905
-                                  . "</doc>";
895
+                                        . "  <child/>\n"
896
+                                        . "  <child/>\n"
897
+                                        . "  <child>value1</child>\n"
898
+                                        . "  <child>value2</child>\n"
899
+                                        . "  <parent>\n"
900
+                                        . "    <child/>\n"
901
+                                        . "    <child/>\n"
902
+                                        . "    <child>value3</child>\n"
903
+                                        . "    <child>value4</child>\n"
904
+                                        . "  </parent>\n"
905
+                                        . "</doc>";
906 906
                         assert_equal_xml($xml, $expected);
907 907
                 });
908 908
 
909 909
                 it('should add a child with some attributes', function() {
910 910
                         $xml = new FluidXml();
911 911
                         $xml->appendChild('child1', ['class' => 'Class attr', 'id' => 'Id attr1'])
912
-                            ->appendChild('parent', true)
913
-                            ->appendChild('child2', ['class' => 'Class attr', 'id' => 'Id attr2']);
912
+                                ->appendChild('parent', true)
913
+                                ->appendChild('child2', ['class' => 'Class attr', 'id' => 'Id attr2']);
914 914
 
915 915
                         $expected = "<doc>\n"
916
-                                  . "  <child1 class=\"Class attr\" id=\"Id attr1\"/>\n"
917
-                                  . "  <parent>\n"
918
-                                  . "    <child2 class=\"Class attr\" id=\"Id attr2\"/>\n"
919
-                                  . "  </parent>\n"
920
-                                  . "</doc>";
916
+                                        . "  <child1 class=\"Class attr\" id=\"Id attr1\"/>\n"
917
+                                        . "  <parent>\n"
918
+                                        . "    <child2 class=\"Class attr\" id=\"Id attr2\"/>\n"
919
+                                        . "  </parent>\n"
920
+                                        . "</doc>";
921 921
                         assert_equal_xml($xml, $expected);
922 922
                 });
923 923
 
924 924
                 it('should add many children with some attributes', function() {
925 925
                         $xml = new FluidXml();
926 926
                         $xml->appendChild(['child1', 'child2'], ['class' => 'Class attr', 'id' => 'Id attr1'])
927
-                            ->appendChild('parent', true)
928
-                            ->appendChild(['child3', 'child4'], ['class' => 'Class attr', 'id' => 'Id attr2']);
927
+                                ->appendChild('parent', true)
928
+                                ->appendChild(['child3', 'child4'], ['class' => 'Class attr', 'id' => 'Id attr2']);
929 929
 
930 930
                         $expected = "<doc>\n"
931
-                                  . "  <child1 class=\"Class attr\" id=\"Id attr1\"/>\n"
932
-                                  . "  <child2 class=\"Class attr\" id=\"Id attr1\"/>\n"
933
-                                  . "  <parent>\n"
934
-                                  . "    <child3 class=\"Class attr\" id=\"Id attr2\"/>\n"
935
-                                  . "    <child4 class=\"Class attr\" id=\"Id attr2\"/>\n"
936
-                                  . "  </parent>\n"
937
-                                  . "</doc>";
931
+                                        . "  <child1 class=\"Class attr\" id=\"Id attr1\"/>\n"
932
+                                        . "  <child2 class=\"Class attr\" id=\"Id attr1\"/>\n"
933
+                                        . "  <parent>\n"
934
+                                        . "    <child3 class=\"Class attr\" id=\"Id attr2\"/>\n"
935
+                                        . "    <child4 class=\"Class attr\" id=\"Id attr2\"/>\n"
936
+                                        . "  </parent>\n"
937
+                                        . "</doc>";
938 938
                         assert_equal_xml($xml, $expected);
939 939
                 });
940 940
 
941 941
                 it('should add children with some attributes and text using the @ syntax', function() {
942 942
                         $xml = new FluidXml();
943 943
                         $attrs = [ '@class' => 'Class attr',
944
-                                   '@'      => 'Text content',
945
-                                   '@id'    => 'Id attr' ];
944
+                                        '@'      => 'Text content',
945
+                                        '@id'    => 'Id attr' ];
946 946
                         $xml->appendChild(['child1' => $attrs ])
947
-                            ->appendChild(['child2' => $attrs ], true)
947
+                                ->appendChild(['child2' => $attrs ], true)
948 948
                                 ->appendChild(['child3' => $attrs ]);
949 949
 
950 950
                         $expected = "<doc>\n"
951
-                                  . "  <child1 class=\"Class attr\" id=\"Id attr\">Text content</child1>\n"
952
-                                  . "  <child2 class=\"Class attr\" id=\"Id attr\">"
953
-                                  .      "Text content"
954
-                                  .      "<child3 class=\"Class attr\" id=\"Id attr\">Text content</child3>"
955
-                                  .    "</child2>\n"
956
-                                  . "</doc>";
951
+                                        . "  <child1 class=\"Class attr\" id=\"Id attr\">Text content</child1>\n"
952
+                                        . "  <child2 class=\"Class attr\" id=\"Id attr\">"
953
+                                        .      "Text content"
954
+                                        .      "<child3 class=\"Class attr\" id=\"Id attr\">Text content</child3>"
955
+                                        .    "</child2>\n"
956
+                                        . "</doc>";
957 957
                         assert_equal_xml($xml, $expected);
958 958
                 });
959 959
 
@@ -984,26 +984,26 @@  discard block
 block discarded – undo
984 984
                         $xml->namespace(new FluidNamespace('x', 'x.com'));
985 985
                         $xml->namespace(fluidns('xx', 'xx.com', FluidNamespace::MODE_IMPLICIT));
986 986
                         $xml->appendChild('x:xTag1', true)
987
-                            ->appendChild('x:xTag2');
987
+                                ->appendChild('x:xTag2');
988 988
                         $xml->appendChild('xx:xxTag1', true)
989
-                            ->appendChild('xx:xxTag2')
990
-                            ->appendChild('tag3');
989
+                                ->appendChild('xx:xxTag2')
990
+                                ->appendChild('tag3');
991 991
 
992 992
                         $expected = "<doc>\n"
993
-                                  . "  <x:xTag1 xmlns:x=\"x.com\">\n"
994
-                                  . "    <x:xTag2/>\n"
995
-                                  . "  </x:xTag1>\n"
996
-                                  . "  <xxTag1 xmlns=\"xx.com\">\n"
997
-                                  . "    <xxTag2/>\n"
998
-                                  . "    <tag3/>\n"
999
-                                  . "  </xxTag1>\n"
1000
-                                  . "</doc>";
993
+                                        . "  <x:xTag1 xmlns:x=\"x.com\">\n"
994
+                                        . "    <x:xTag2/>\n"
995
+                                        . "  </x:xTag1>\n"
996
+                                        . "  <xxTag1 xmlns=\"xx.com\">\n"
997
+                                        . "    <xxTag2/>\n"
998
+                                        . "    <tag3/>\n"
999
+                                        . "  </xxTag1>\n"
1000
+                                        . "</doc>";
1001 1001
                         assert_equal_xml($xml, $expected);
1002 1002
                 });
1003 1003
 
1004 1004
                 $doc = "<doc>\n"
1005
-                     . "  <parent>content</parent>\n"
1006
-                     . "</doc>";
1005
+                        . "  <parent>content</parent>\n"
1006
+                        . "</doc>";
1007 1007
                 $dom = new \DOMDocument();
1008 1008
                 $dom->loadXML($doc);
1009 1009
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
                         $xml->appendChild('<root1/><root2/>');
1021 1021
 
1022 1022
                         $expected = "<root1/>\n"
1023
-                                  . "<root2/>";
1023
+                                        . "<root2/>";
1024 1024
                         assert_equal_xml($xml, $expected);
1025 1025
                 });
1026 1026
 
@@ -1029,21 +1029,21 @@  discard block
 block discarded – undo
1029 1029
                         $xml->appendChild('<child1/><child2/>');
1030 1030
 
1031 1031
                         $expected = "<doc>\n"
1032
-                                  . "  <child1/>\n"
1033
-                                  . "  <child2/>\n"
1034
-                                  . "</doc>";
1032
+                                        . "  <child1/>\n"
1033
+                                        . "  <child2/>\n"
1034
+                                        . "</doc>";
1035 1035
                         assert_equal_xml($xml, $expected);
1036 1036
 
1037 1037
                         $xml = new FluidXml();
1038 1038
                         $xml->appendChild('parent', true)
1039
-                            ->appendChild('<child1/><child2/>');
1039
+                                ->appendChild('<child1/><child2/>');
1040 1040
 
1041 1041
                         $expected = "<doc>\n"
1042
-                                  . "  <parent>\n"
1043
-                                  . "    <child1/>\n"
1044
-                                  . "    <child2/>\n"
1045
-                                  . "  </parent>\n"
1046
-                                  . "</doc>";
1042
+                                        . "  <parent>\n"
1043
+                                        . "    <child1/>\n"
1044
+                                        . "    <child2/>\n"
1045
+                                        . "  </parent>\n"
1046
+                                        . "</doc>";
1047 1047
                         assert_equal_xml($xml, $expected);
1048 1048
                 });
1049 1049
 
@@ -1110,14 +1110,14 @@  discard block
 block discarded – undo
1110 1110
                         $fxml = FluidXml::load($dom)->query('/doc/parent');
1111 1111
                         $xml  = new FluidXml();
1112 1112
                         $xml->appendChild([ $fxml,
1113
-                                            'imported' => $fxml ]);
1113
+                                                'imported' => $fxml ]);
1114 1114
 
1115 1115
                         $expected = "<doc>\n"
1116
-                                  . "  <parent>content</parent>\n"
1117
-                                  . "  <imported>\n"
1118
-                                  . "    <parent>content</parent>\n"
1119
-                                  . "  </imported>\n"
1120
-                                  . "</doc>";
1116
+                                        . "  <parent>content</parent>\n"
1117
+                                        . "  <imported>\n"
1118
+                                        . "    <parent>content</parent>\n"
1119
+                                        . "  </imported>\n"
1120
+                                        . "</doc>";
1121 1121
                         assert_equal_xml($xml, $expected);
1122 1122
                 });
1123 1123
 
@@ -1175,14 +1175,14 @@  discard block
 block discarded – undo
1175 1175
                 it('should add a sibling node before a node', function() {
1176 1176
                         $xml = new FluidXml();
1177 1177
                         $xml->appendChild('parent', true)
1178
-                            ->prependSibling('sibling1')
1179
-                            ->prependSibling('sibling2');
1178
+                                ->prependSibling('sibling1')
1179
+                                ->prependSibling('sibling2');
1180 1180
 
1181 1181
                         $expected = "<doc>\n"
1182
-                                  . "  <sibling1/>\n"
1183
-                                  . "  <sibling2/>\n"
1184
-                                  . "  <parent/>\n"
1185
-                                  . "</doc>";
1182
+                                        . "  <sibling1/>\n"
1183
+                                        . "  <sibling2/>\n"
1184
+                                        . "  <parent/>\n"
1185
+                                        . "</doc>";
1186 1186
                         assert_equal_xml($xml, $expected);
1187 1187
                 });
1188 1188
 
@@ -1194,17 +1194,17 @@  discard block
 block discarded – undo
1194 1194
                         $xml->prependSibling($dom);
1195 1195
 
1196 1196
                         $expected = "<parent>content</parent>\n"
1197
-                                  . "<doc/>";
1197
+                                        . "<doc/>";
1198 1198
                         assert_equal_xml($xml, $expected);
1199 1199
 
1200 1200
                         $xml = new FluidXml();
1201 1201
                         $xml->appendChild('sibling', true)
1202
-                            ->prependSibling($dom);
1202
+                                ->prependSibling($dom);
1203 1203
 
1204 1204
                         $expected = "<doc>\n"
1205
-                                  . "  <parent>content</parent>\n"
1206
-                                  . "  <sibling/>\n"
1207
-                                  . "</doc>";
1205
+                                        . "  <parent>content</parent>\n"
1206
+                                        . "  <sibling/>\n"
1207
+                                        . "</doc>";
1208 1208
                         assert_equal_xml($xml, $expected);
1209 1209
                 });
1210 1210
         });
@@ -1251,14 +1251,14 @@  discard block
 block discarded – undo
1251 1251
                 it('should add a sibling node after a node', function() {
1252 1252
                         $xml = new FluidXml();
1253 1253
                         $xml->appendChild('parent', true)
1254
-                            ->appendSibling('sibling1')
1255
-                            ->appendSibling('sibling2');
1254
+                                ->appendSibling('sibling1')
1255
+                                ->appendSibling('sibling2');
1256 1256
 
1257 1257
                         $expected = "<doc>\n"
1258
-                                  . "  <parent/>\n"
1259
-                                  . "  <sibling2/>\n"
1260
-                                  . "  <sibling1/>\n"
1261
-                                  . "</doc>";
1258
+                                        . "  <parent/>\n"
1259
+                                        . "  <sibling2/>\n"
1260
+                                        . "  <sibling1/>\n"
1261
+                                        . "</doc>";
1262 1262
                         assert_equal_xml($xml, $expected);
1263 1263
                 });
1264 1264
 
@@ -1270,17 +1270,17 @@  discard block
 block discarded – undo
1270 1270
                         $xml->appendSibling($dom);
1271 1271
 
1272 1272
                         $expected = "<doc/>\n"
1273
-                                  . "<parent>content</parent>";
1273
+                                        . "<parent>content</parent>";
1274 1274
                         assert_equal_xml($xml, $expected);
1275 1275
 
1276 1276
                         $xml = new FluidXml();
1277 1277
                         $xml->appendChild('sibling', true)
1278
-                            ->appendSibling($dom);
1278
+                                ->appendSibling($dom);
1279 1279
 
1280 1280
                         $expected = "<doc>\n"
1281
-                                  . "  <sibling/>\n"
1282
-                                  . "  <parent>content</parent>\n"
1283
-                                  . "</doc>";
1281
+                                        . "  <sibling/>\n"
1282
+                                        . "  <parent>content</parent>\n"
1283
+                                        . "</doc>";
1284 1284
                         assert_equal_xml($xml, $expected);
1285 1285
                 });
1286 1286
         });
@@ -1293,14 +1293,14 @@  discard block
 block discarded – undo
1293 1293
                 it('should set the attributes of the root node', function() {
1294 1294
                         $xml = new FluidXml();
1295 1295
                         $xml->setAttribute('attr1', 'Attr1 Value')
1296
-                            ->setAttribute('attr2', 'Attr2 Value');
1296
+                                ->setAttribute('attr2', 'Attr2 Value');
1297 1297
 
1298 1298
                         $expected = "<doc attr1=\"Attr1 Value\" attr2=\"Attr2 Value\"/>";
1299 1299
                         assert_equal_xml($xml, $expected);
1300 1300
 
1301 1301
                         $xml = new FluidXml();
1302 1302
                         $xml->setAttribute(['attr1' => 'Attr1 Value',
1303
-                                            'attr2' => 'Attr2 Value']);
1303
+                                                'attr2' => 'Attr2 Value']);
1304 1304
 
1305 1305
                         $expected = "<doc attr1=\"Attr1 Value\" attr2=\"Attr2 Value\"/>";
1306 1306
                         assert_equal_xml($xml, $expected);
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
                 it('should change the attributes of the root node', function() {
1310 1310
                         $xml = new FluidXml();
1311 1311
                         $xml->setAttribute('attr1', 'Attr1 Value')
1312
-                            ->setAttribute('attr2', 'Attr2 Value');
1312
+                                ->setAttribute('attr2', 'Attr2 Value');
1313 1313
 
1314 1314
                         $xml->setAttribute('attr2', 'Attr2 New Value');
1315 1315
 
@@ -1325,46 +1325,46 @@  discard block
 block discarded – undo
1325 1325
                 it('should set the attributes of a node', function() {
1326 1326
                         $xml = new FluidXml();
1327 1327
                         $xml->appendChild('child', true)
1328
-                            ->setAttribute('attr1', 'Attr1 Value')
1329
-                            ->setAttribute('attr2', 'Attr2 Value');
1328
+                                ->setAttribute('attr1', 'Attr1 Value')
1329
+                                ->setAttribute('attr2', 'Attr2 Value');
1330 1330
 
1331 1331
                         $expected = "<doc>\n"
1332
-                                  . "  <child attr1=\"Attr1 Value\" attr2=\"Attr2 Value\"/>\n"
1333
-                                  . "</doc>";
1332
+                                        . "  <child attr1=\"Attr1 Value\" attr2=\"Attr2 Value\"/>\n"
1333
+                                        . "</doc>";
1334 1334
                         assert_equal_xml($xml, $expected);
1335 1335
 
1336 1336
                         $xml = new FluidXml();
1337 1337
                         $xml->appendChild('child', true)
1338
-                            ->setAttribute(['attr1' => 'Attr1 Value',
1339
-                                            'attr2' => 'Attr2 Value']);
1338
+                                ->setAttribute(['attr1' => 'Attr1 Value',
1339
+                                                'attr2' => 'Attr2 Value']);
1340 1340
 
1341 1341
                         $expected = "<doc>\n"
1342
-                                  . "  <child attr1=\"Attr1 Value\" attr2=\"Attr2 Value\"/>\n"
1343
-                                  . "</doc>";
1342
+                                        . "  <child attr1=\"Attr1 Value\" attr2=\"Attr2 Value\"/>\n"
1343
+                                        . "</doc>";
1344 1344
                         assert_equal_xml($xml, $expected);
1345 1345
                 });
1346 1346
 
1347 1347
                 it('should change the attributes of a node', function() {
1348 1348
                         $xml = new FluidXml();
1349 1349
                         $xml->appendChild('child', true)
1350
-                            ->setAttribute('attr1', 'Attr1 Value')
1351
-                            ->setAttribute('attr2', 'Attr2 Value')
1352
-                            ->setAttribute('attr2', 'Attr2 New Value');
1350
+                                ->setAttribute('attr1', 'Attr1 Value')
1351
+                                ->setAttribute('attr2', 'Attr2 Value')
1352
+                                ->setAttribute('attr2', 'Attr2 New Value');
1353 1353
 
1354 1354
                         $expected = "<doc>\n"
1355
-                                  . "  <child attr1=\"Attr1 Value\" attr2=\"Attr2 New Value\"/>\n"
1356
-                                  . "</doc>";
1355
+                                        . "  <child attr1=\"Attr1 Value\" attr2=\"Attr2 New Value\"/>\n"
1356
+                                        . "</doc>";
1357 1357
                         assert_equal_xml($xml, $expected);
1358 1358
 
1359 1359
                         $xml = new FluidXml();
1360 1360
                         $xml->appendChild('child', true)
1361
-                            ->setAttribute(['attr1' => 'Attr1 Value',
1362
-                                            'attr2' => 'Attr2 Value'])
1363
-                            ->setAttribute('attr1', 'Attr1 New Value');
1361
+                                ->setAttribute(['attr1' => 'Attr1 Value',
1362
+                                                'attr2' => 'Attr2 Value'])
1363
+                                ->setAttribute('attr1', 'Attr1 New Value');
1364 1364
 
1365 1365
                         $expected = "<doc>\n"
1366
-                                  . "  <child attr1=\"Attr1 New Value\" attr2=\"Attr2 Value\"/>\n"
1367
-                                  . "</doc>";
1366
+                                        . "  <child attr1=\"Attr1 New Value\" attr2=\"Attr2 Value\"/>\n"
1367
+                                        . "</doc>";
1368 1368
                         assert_equal_xml($xml, $expected);
1369 1369
                 });
1370 1370
         });
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
                 it('should add text to the root node', function() {
1378 1378
                         $xml = new FluidXml();
1379 1379
                         $xml->appendText('First Line')
1380
-                            ->appendText('Second Line');
1380
+                                ->appendText('Second Line');
1381 1381
 
1382 1382
                         $expected = "<doc>First LineSecond Line</doc>";
1383 1383
                         assert_equal_xml($xml, $expected);
@@ -1387,11 +1387,11 @@  discard block
 block discarded – undo
1387 1387
                         $xml = new FluidXml();
1388 1388
                         $cx = $xml->appendChild('p', true);
1389 1389
                         $cx->appendText('First Line')
1390
-                           ->appendText('Second Line');
1390
+                                ->appendText('Second Line');
1391 1391
 
1392 1392
                         $expected = "<doc>\n"
1393
-                                  . "  <p>First LineSecond Line</p>\n"
1394
-                                  . "</doc>";
1393
+                                        . "  <p>First LineSecond Line</p>\n"
1394
+                                        . "</doc>";
1395 1395
                         assert_equal_xml($xml, $expected);
1396 1396
                 });
1397 1397
         });
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
                 it('should set/change the text of the root node', function() {
1405 1405
                         $xml = new FluidXml();
1406 1406
                         $xml->setText('First Text')
1407
-                            ->setText('Second Text');
1407
+                                ->setText('Second Text');
1408 1408
 
1409 1409
                         $expected = "<doc>Second Text</doc>";
1410 1410
                         assert_equal_xml($xml, $expected);
@@ -1414,11 +1414,11 @@  discard block
 block discarded – undo
1414 1414
                         $xml = new FluidXml();
1415 1415
                         $cx = $xml->appendChild('p', true);
1416 1416
                         $cx->setText('First Text')
1417
-                           ->setText('Second Text');
1417
+                                ->setText('Second Text');
1418 1418
 
1419 1419
                         $expected = "<doc>\n"
1420
-                                  . "  <p>Second Text</p>\n"
1421
-                                  . "</doc>";
1420
+                                        . "  <p>Second Text</p>\n"
1421
+                                        . "</doc>";
1422 1422
                         assert_equal_xml($xml, $expected);
1423 1423
                 });
1424 1424
         });
@@ -1431,12 +1431,12 @@  discard block
 block discarded – undo
1431 1431
                 it('should add CDATA to the root node', function() {
1432 1432
                         $xml = new FluidXml();
1433 1433
                         $xml->appendCdata('// <, > are characters that should be escaped in a XML context.')
1434
-                            ->appendCdata('// Even & is a characters that should be escaped in a XML context.');
1434
+                                ->appendCdata('// Even & is a characters that should be escaped in a XML context.');
1435 1435
 
1436 1436
                         $expected = "<doc>"
1437
-                                  . "<![CDATA[// <, > are characters that should be escaped in a XML context.]]>"
1438
-                                  . "<![CDATA[// Even & is a characters that should be escaped in a XML context.]]>"
1439
-                                  . "</doc>";
1437
+                                        . "<![CDATA[// <, > are characters that should be escaped in a XML context.]]>"
1438
+                                        . "<![CDATA[// Even & is a characters that should be escaped in a XML context.]]>"
1439
+                                        . "</doc>";
1440 1440
                         assert_equal_xml($xml, $expected);
1441 1441
                 });
1442 1442
 
@@ -1444,14 +1444,14 @@  discard block
 block discarded – undo
1444 1444
                         $xml = new FluidXml();
1445 1445
                         $cx = $xml->appendChild('pre', true);
1446 1446
                         $cx->appendCdata('// <, > are characters that should be escaped in a XML context.')
1447
-                           ->appendCdata('// Even & is a characters that should be escaped in a XML context.');
1447
+                                ->appendCdata('// Even & is a characters that should be escaped in a XML context.');
1448 1448
 
1449 1449
                         $expected = "<doc>\n"
1450
-                                  . "  <pre>"
1451
-                                  . "<![CDATA[// <, > are characters that should be escaped in a XML context.]]>"
1452
-                                  . "<![CDATA[// Even & is a characters that should be escaped in a XML context.]]>"
1453
-                                  .    "</pre>\n"
1454
-                                  . "</doc>";
1450
+                                        . "  <pre>"
1451
+                                        . "<![CDATA[// <, > are characters that should be escaped in a XML context.]]>"
1452
+                                        . "<![CDATA[// Even & is a characters that should be escaped in a XML context.]]>"
1453
+                                        .    "</pre>\n"
1454
+                                        . "</doc>";
1455 1455
                         assert_equal_xml($xml, $expected);
1456 1456
                 });
1457 1457
         });
@@ -1464,7 +1464,7 @@  discard block
 block discarded – undo
1464 1464
                 it('should set/change the CDATA of the root node', function() {
1465 1465
                         $xml = new FluidXml();
1466 1466
                         $xml->setCdata('First Data')
1467
-                            ->setCdata('Second Data');
1467
+                                ->setCdata('Second Data');
1468 1468
 
1469 1469
                         $expected = "<doc><![CDATA[Second Data]]></doc>";
1470 1470
                         assert_equal_xml($xml, $expected);
@@ -1474,24 +1474,24 @@  discard block
 block discarded – undo
1474 1474
                         $xml = new FluidXml();
1475 1475
                         $cx = $xml->appendChild('p', true);
1476 1476
                         $cx->setCdata('First Data')
1477
-                           ->setCdata('Second Data');
1477
+                                ->setCdata('Second Data');
1478 1478
 
1479 1479
                         $expected = "<doc>\n"
1480
-                                  . "  <p><![CDATA[Second Data]]></p>\n"
1481
-                                  . "</doc>";
1480
+                                        . "  <p><![CDATA[Second Data]]></p>\n"
1481
+                                        . "</doc>";
1482 1482
                         assert_equal_xml($xml, $expected);
1483 1483
                 });
1484 1484
         });
1485 1485
 
1486 1486
         describe('.remove', function() {
1487 1487
                 $expected = "<doc>\n"
1488
-                          . "  <parent/>\n"
1489
-                          . "</doc>";
1488
+                                . "  <parent/>\n"
1489
+                                . "</doc>";
1490 1490
 
1491 1491
                 $new_doc = function() {
1492 1492
                         $xml = new FluidXml();
1493 1493
                         $xml->appendChild('parent', true)
1494
-                            ->appendChild(['child1', 'child2'], ['class'=>'removable']);
1494
+                                ->appendChild(['child1', 'child2'], ['class'=>'removable']);
1495 1495
 
1496 1496
                         return $xml;
1497 1497
                 };
@@ -1573,10 +1573,10 @@  discard block
 block discarded – undo
1573 1573
                                 ->appendChild('child', 'content');
1574 1574
 
1575 1575
                         $expected = "<doc>\n"
1576
-                                  . "  <parent>\n"
1577
-                                  . "    <child>content</child>\n"
1578
-                                  . "  </parent>\n"
1579
-                                  . "</doc>";
1576
+                                        . "  <parent>\n"
1577
+                                        . "    <child>content</child>\n"
1578
+                                        . "  </parent>\n"
1579
+                                        . "</doc>";
1580 1580
 
1581 1581
                         assert_equal_xml($xml, $expected);
1582 1582
                 });
@@ -1588,10 +1588,10 @@  discard block
 block discarded – undo
1588 1588
 
1589 1589
                         $actual   = $xml->xml(true);
1590 1590
                         $expected = "<doc>\n"
1591
-                                  . "  <parent>\n"
1592
-                                  . "    <child>content</child>\n"
1593
-                                  . "  </parent>\n"
1594
-                                  . "</doc>";
1591
+                                        . "  <parent>\n"
1592
+                                        . "    <child>content</child>\n"
1593
+                                        . "  </parent>\n"
1594
+                                        . "</doc>";
1595 1595
                         \assert($actual === $expected, __($actual, $expected));
1596 1596
                 });
1597 1597
 
@@ -1612,7 +1612,7 @@  discard block
 block discarded – undo
1612 1612
 
1613 1613
                         $actual   = $xml->query('//child')->xml();
1614 1614
                         $expected = "<child>content1</child>\n"
1615
-                                  . "<child>content2</child>";
1615
+                                        . "<child>content2</child>";
1616 1616
                         \assert($actual === $expected, __($actual, $expected));
1617 1617
                 });
1618 1618
         });
@@ -1625,11 +1625,11 @@  discard block
 block discarded – undo
1625 1625
                 it('should behave like .appendChild', function() {
1626 1626
                         $xml = new FluidXml();
1627 1627
                         $xml->appendChild('parent', true)
1628
-                            ->appendChild(['child1', 'child2'], ['class'=>'child']);
1628
+                                ->appendChild(['child1', 'child2'], ['class'=>'child']);
1629 1629
 
1630 1630
                         $alias = new FluidXml();
1631 1631
                         $alias->add('parent', true)
1632
-                              ->add(['child1', 'child2'], ['class'=>'child']);
1632
+                                ->add(['child1', 'child2'], ['class'=>'child']);
1633 1633
 
1634 1634
                         $actual   = $xml->xml();
1635 1635
                         $expected = $alias->xml();
@@ -1645,11 +1645,11 @@  discard block
 block discarded – undo
1645 1645
                 it('should behave like .prependSibling', function() {
1646 1646
                         $xml = new FluidXml();
1647 1647
                         $xml->prependSibling('sibling1', true)
1648
-                            ->prependSibling(['sibling2', 'sibling3'], ['class'=>'sibling']);
1648
+                                ->prependSibling(['sibling2', 'sibling3'], ['class'=>'sibling']);
1649 1649
 
1650 1650
                         $alias = new FluidXml();
1651 1651
                         $alias->prepend('sibling1', true)
1652
-                              ->prepend(['sibling2', 'sibling3'], ['class'=>'sibling']);
1652
+                                ->prepend(['sibling2', 'sibling3'], ['class'=>'sibling']);
1653 1653
 
1654 1654
                         $actual   = $xml->xml();
1655 1655
                         $expected = $alias->xml();
@@ -1665,11 +1665,11 @@  discard block
 block discarded – undo
1665 1665
                 it('should behave like .prependSibling', function() {
1666 1666
                         $xml = new FluidXml();
1667 1667
                         $xml->prependSibling('sibling1', true)
1668
-                            ->prependSibling(['sibling2', 'sibling3'], ['class'=>'sibling']);
1668
+                                ->prependSibling(['sibling2', 'sibling3'], ['class'=>'sibling']);
1669 1669
 
1670 1670
                         $alias = new FluidXml();
1671 1671
                         $alias->insertSiblingBefore('sibling1', true)
1672
-                              ->insertSiblingBefore(['sibling2', 'sibling3'], ['class'=>'sibling']);
1672
+                                ->insertSiblingBefore(['sibling2', 'sibling3'], ['class'=>'sibling']);
1673 1673
 
1674 1674
                         $actual   = $xml->xml();
1675 1675
                         $expected = $alias->xml();
@@ -1685,11 +1685,11 @@  discard block
 block discarded – undo
1685 1685
                 it('should behave like .appendSibling', function() {
1686 1686
                         $xml = new FluidXml();
1687 1687
                         $xml->appendSibling('sibling1', true)
1688
-                            ->appendSibling(['sibling2', 'sibling3'], ['class'=>'sibling']);
1688
+                                ->appendSibling(['sibling2', 'sibling3'], ['class'=>'sibling']);
1689 1689
 
1690 1690
                         $alias = new FluidXml();
1691 1691
                         $alias->append('sibling1', true)
1692
-                              ->append(['sibling2', 'sibling3'], ['class'=>'sibling']);
1692
+                                ->append(['sibling2', 'sibling3'], ['class'=>'sibling']);
1693 1693
 
1694 1694
                         $actual   = $xml->xml();
1695 1695
                         $expected = $alias->xml();
@@ -1705,11 +1705,11 @@  discard block
 block discarded – undo
1705 1705
                 it('should behave like .appendSibling', function() {
1706 1706
                         $xml = new FluidXml();
1707 1707
                         $xml->appendSibling('sibling1', true)
1708
-                            ->appendSibling(['sibling2', 'sibling3'], ['class'=>'sibling']);
1708
+                                ->appendSibling(['sibling2', 'sibling3'], ['class'=>'sibling']);
1709 1709
 
1710 1710
                         $alias = new FluidXml();
1711 1711
                         $alias->insertSiblingAfter('sibling1', true)
1712
-                              ->insertSiblingAfter(['sibling2', 'sibling3'], ['class'=>'sibling']);
1712
+                                ->insertSiblingAfter(['sibling2', 'sibling3'], ['class'=>'sibling']);
1713 1713
 
1714 1714
                         $actual   = $xml->xml();
1715 1715
                         $expected = $alias->xml();
@@ -1725,17 +1725,17 @@  discard block
 block discarded – undo
1725 1725
                 it('should behave like .setAttribute', function() {
1726 1726
                         $xml = new FluidXml();
1727 1727
                         $xml->setAttribute('attr1', 'Attr1 Value')
1728
-                            ->setAttribute(['attr2' => 'Attr2 Value', 'attr3' => 'Attr3 Value'])
1729
-                            ->appendChild('child', true)
1730
-                            ->setAttribute('attr4', 'Attr4 Value')
1731
-                            ->setAttribute(['attr5' => 'Attr5 Value', 'attr6' => 'Attr6 Value']);
1728
+                                ->setAttribute(['attr2' => 'Attr2 Value', 'attr3' => 'Attr3 Value'])
1729
+                                ->appendChild('child', true)
1730
+                                ->setAttribute('attr4', 'Attr4 Value')
1731
+                                ->setAttribute(['attr5' => 'Attr5 Value', 'attr6' => 'Attr6 Value']);
1732 1732
 
1733 1733
                         $alias = new FluidXml();
1734 1734
                         $alias->attr('attr1', 'Attr1 Value')
1735
-                              ->attr(['attr2' => 'Attr2 Value', 'attr3' => 'Attr3 Value'])
1736
-                              ->appendChild('child', true)
1737
-                              ->attr('attr4', 'Attr4 Value')
1738
-                              ->attr(['attr5' => 'Attr5 Value', 'attr6' => 'Attr6 Value']);
1735
+                                ->attr(['attr2' => 'Attr2 Value', 'attr3' => 'Attr3 Value'])
1736
+                                ->appendChild('child', true)
1737
+                                ->attr('attr4', 'Attr4 Value')
1738
+                                ->attr(['attr5' => 'Attr5 Value', 'attr6' => 'Attr6 Value']);
1739 1739
 
1740 1740
                         $actual   = $xml->xml();
1741 1741
                         $expected = $alias->xml();
@@ -1751,13 +1751,13 @@  discard block
 block discarded – undo
1751 1751
                 it('should behave like .setText', function() {
1752 1752
                         $xml = new FluidXml();
1753 1753
                         $xml->setText('Text1')
1754
-                            ->appendChild('child', true)
1755
-                            ->setText('Text2');
1754
+                                ->appendChild('child', true)
1755
+                                ->setText('Text2');
1756 1756
 
1757 1757
                         $alias = new FluidXml();
1758 1758
                         $alias->text('Text1')
1759
-                              ->appendChild('child', true)
1760
-                              ->text('Text2');
1759
+                                ->appendChild('child', true)
1760
+                                ->text('Text2');
1761 1761
 
1762 1762
                         $actual   = $xml->xml();
1763 1763
                         $expected = $alias->xml();
@@ -1773,13 +1773,13 @@  discard block
 block discarded – undo
1773 1773
                 it('should behave like .setCdata', function() {
1774 1774
                         $xml = new FluidXml();
1775 1775
                         $xml->setCdata('Text1')
1776
-                            ->appendChild('child', true)
1777
-                            ->setCdata('Text2');
1776
+                                ->appendChild('child', true)
1777
+                                ->setCdata('Text2');
1778 1778
 
1779 1779
                         $alias = new FluidXml();
1780 1780
                         $alias->cdata('Text1')
1781
-                              ->appendChild('child', true)
1782
-                              ->cdata('Text2');
1781
+                                ->appendChild('child', true)
1782
+                                ->cdata('Text2');
1783 1783
 
1784 1784
                         $actual   = $xml->xml();
1785 1785
                         $expected = $alias->xml();
@@ -1929,25 +1929,25 @@  discard block
 block discarded – undo
1929 1929
                         \assert($actual === $expected, __($actual, $expected));
1930 1930
 
1931 1931
                         $expected = "<doc>\n"
1932
-                                  . "  <child1>\n"
1933
-                                  . "    <subchild1/>\n"
1934
-                                  . "    <subchild2/>\n"
1935
-                                  . "    <subchild3/>\n"
1936
-                                  . "    <subchild4/>\n"
1937
-                                  . "    <subchild5/>\n"
1938
-                                  . "    <subchild6/>\n"
1939
-                                  . "    <subchild7/>\n"
1940
-                                  . "  </child1>\n"
1941
-                                  . "  <child2>\n"
1942
-                                  . "    <subchild1/>\n"
1943
-                                  . "    <subchild2/>\n"
1944
-                                  . "    <subchild3/>\n"
1945
-                                  . "    <subchild4/>\n"
1946
-                                  . "    <subchild5/>\n"
1947
-                                  . "    <subchild6/>\n"
1948
-                                  . "    <subchild7/>\n"
1949
-                                  . "  </child2>\n"
1950
-                                  . "</doc>";
1932
+                                        . "  <child1>\n"
1933
+                                        . "    <subchild1/>\n"
1934
+                                        . "    <subchild2/>\n"
1935
+                                        . "    <subchild3/>\n"
1936
+                                        . "    <subchild4/>\n"
1937
+                                        . "    <subchild5/>\n"
1938
+                                        . "    <subchild6/>\n"
1939
+                                        . "    <subchild7/>\n"
1940
+                                        . "  </child1>\n"
1941
+                                        . "  <child2>\n"
1942
+                                        . "    <subchild1/>\n"
1943
+                                        . "    <subchild2/>\n"
1944
+                                        . "    <subchild3/>\n"
1945
+                                        . "    <subchild4/>\n"
1946
+                                        . "    <subchild5/>\n"
1947
+                                        . "    <subchild6/>\n"
1948
+                                        . "    <subchild7/>\n"
1949
+                                        . "  </child2>\n"
1950
+                                        . "</doc>";
1951 1951
                         assert_equal_xml($xml, $expected);
1952 1952
                 });
1953 1953
         });
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
                         $ns_uri  = 'x.com';
1987 1987
                         $ns_mode = FluidNamespace::MODE_EXPLICIT;
1988 1988
                         $args    = [ FluidNamespace::ID  => $ns_id,
1989
-                                     FluidNamespace::URI => $ns_uri ];
1989
+                                        FluidNamespace::URI => $ns_uri ];
1990 1990
                         $ns      = new FluidNamespace($args);
1991 1991
 
1992 1992
                         $actual   = $ns->id();
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
                 $expected = $xml->xml();
25 25
                 \assert($actual === $expected, __($actual, $expected));
26 26
 
27
-                $options = [ 'root'       => 'root',
27
+                $options = ['root'       => 'root',
28 28
                              'version'    => '1.2',
29 29
                              'encoding'   => 'UTF-16',
30
-                             'stylesheet' => 'stylesheet.xsl' ];
30
+                             'stylesheet' => 'stylesheet.xsl'];
31 31
 
32 32
                 $xml   = new FluidXml($options);
33 33
                 $alias = fluidxml($options);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 describe('domnodes_to_string', function() {
133 133
         it('should convert an array of DOMNode instances to an XML string', function() {
134 134
                 $xml   = new FluidXml();
135
-                $nodes = [ $xml->dom()->documentElement ];
135
+                $nodes = [$xml->dom()->documentElement];
136 136
 
137 137
                 $actual   = domnodes_to_string($nodes);
138 138
                 $expected = "<doc/>";
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                         try {
238 238
                                 $xml = FluidXml::load('.impossible.xml');
239 239
                         } catch (\Exception $e) {
240
-                                $actual   = $e;
240
+                                $actual = $e;
241 241
                         }
242 242
 
243 243
                         assert_is_a($actual, \Exception::class);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
                         try {
248 248
                                 $xml = FluidXml::load(0);
249 249
                         } catch (\Exception $e) {
250
-                                $actual   = $e;
250
+                                $actual = $e;
251 251
                         }
252 252
 
253 253
                         assert_is_a($actual, \Exception::class);
@@ -257,19 +257,19 @@  discard block
 block discarded – undo
257 257
         if (\version_compare(\phpversion(), '7', '>=')) {
258 258
         describe(':new', function() {
259 259
                 it('should behave like FluidXml::__construct', function() {
260
-                        $xml   = new FluidXml();
260
+                        $xml = new FluidXml();
261 261
                         eval('$alias = \FluidXml\FluidXml::new();');
262 262
 
263 263
                         $actual   = $alias->xml();
264 264
                         $expected = $xml->xml();
265 265
                         \assert($actual === $expected, __($actual, $expected));
266 266
 
267
-                        $options = [ 'root'       => 'root',
267
+                        $options = ['root'       => 'root',
268 268
                                      'version'    => '1.2',
269 269
                                      'encoding'   => 'UTF-16',
270
-                                     'stylesheet' => 'stylesheet.xsl' ];
270
+                                     'stylesheet' => 'stylesheet.xsl'];
271 271
 
272
-                        $xml   = new FluidXml($options);
272
+                        $xml = new FluidXml($options);
273 273
                         eval('$alias = \FluidXml\FluidXml::new($options);');
274 274
 
275 275
                         $actual   = $alias->xml();
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
                         $x_ns  = new FluidNamespace('x', 'x.com');
426 426
                         $xx_ns = fluidns('xx', 'xx.com', FluidNamespace::MODE_IMPLICIT);
427 427
 
428
-                        $nss = $xml->namespace([ $x_ns, $xx_ns ])
428
+                        $nss = $xml->namespace([$x_ns, $xx_ns])
429 429
                                    ->namespaces();
430 430
 
431 431
                         $actual   = $nss[$x_ns->id()];
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                 it('should accept an array of queries', function() {
468 468
                         $xml = new FluidXml();
469 469
                         $xml->appendChild('html', true)
470
-                            ->appendChild(['head','body']);
470
+                            ->appendChild(['head', 'body']);
471 471
                         $xml->query(['//html', '//head', '//body'])
472 472
                             ->setAttribute('lang', 'en');
473 473
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 
482 482
                         $xml = new FluidXml();
483 483
                         $xml->appendChild('html', true)
484
-                            ->appendChild(['head','body'])
484
+                            ->appendChild(['head', 'body'])
485 485
                             ->query(['.', 'head', 'body'])
486 486
                             ->setAttribute('lang', 'en');
487 487
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                 it('should accept variable queries arguments', function() {
498 498
                         $xml = new FluidXml();
499 499
                         $xml->appendChild('html', true)
500
-                            ->appendChild(['head','body']);
500
+                            ->appendChild(['head', 'body']);
501 501
                         $xml->query('//html', '//head', '//body')
502 502
                             ->setAttribute('lang', 'en');
503 503
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 
512 512
                         $xml = new FluidXml();
513 513
                         $xml->appendChild('html', true)
514
-                            ->appendChild(['head','body'])
514
+                            ->appendChild(['head', 'body'])
515 515
                             ->query('.', 'head', 'body')
516 516
                             ->setAttribute('lang', 'en');
517 517
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                         // XPATH: //child subchild
529 529
                         $xml = new FluidXml();
530 530
                         $cx = $xml->appendChild('html', true);
531
-                        $cx->appendChild(['head','body']);
531
+                        $cx->appendChild(['head', 'body']);
532 532
                         $cx = $cx->query('body');
533 533
 
534 534
                         $actual   = $cx[0]->nodeName;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                         \assert($actual === $expected, __($actual, $expected));
537 537
 
538 538
                         $xml = new FluidXml();
539
-                        $xml->appendChild('html', true)->appendChild(['head','body']);
539
+                        $xml->appendChild('html', true)->appendChild(['head', 'body']);
540 540
                         $cx = $xml->query('/doc/html')->query('head');
541 541
 
542 542
                         $actual   = $cx[0]->nodeName;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
                         // XPATH: //child/subchild //child
549 549
                         $xml = new FluidXml();
550 550
                         $xml->appendChild('html', true)
551
-                            ->appendChild(['head','body']);
551
+                            ->appendChild(['head', 'body']);
552 552
                         $cx = $xml->query('/doc/html/body')
553 553
                                   ->appendChild('h1')
554 554
                                   ->query('/doc/html/head');
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
                         // XPATH: //child/subchild ../..
563 563
                         $xml = new FluidXml();
564 564
                         $xml->appendChild('html', true)
565
-                            ->appendChild(['head','body'], true)
565
+                            ->appendChild(['head', 'body'], true)
566 566
                             ->query('../body')
567 567
                             ->appendChild('h1')
568 568
                             ->query('../..')
@@ -587,12 +587,12 @@  discard block
 block discarded – undo
587 587
 
588 588
                         $xml->namespace($x_ns, $xx_ns);
589 589
 
590
-                        $xml->appendChild('x:a',  true)
591
-                            ->appendChild('x:b',  true)
590
+                        $xml->appendChild('x:a', true)
591
+                            ->appendChild('x:b', true)
592 592
                             ->appendChild('xx:c', true)
593 593
                             ->appendChild('xx:d', true)
594
-                            ->appendChild('e',    true)
595
-                            ->appendChild('x:f',  true)
594
+                            ->appendChild('e', true)
595
+                            ->appendChild('x:f', true)
596 596
                             ->appendChild('g');
597 597
 
598 598
                         $r = $xml->query('/doc/a');
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 
660 660
         describe('.each', function() {
661 661
                 it('should be fluid', function() {
662
-                        assert_is_fluid('each', function(){});
662
+                        assert_is_fluid('each', function() {});
663 663
                 });
664 664
 
665 665
                 it('should iterate the nodes inside the context', function() {
@@ -887,9 +887,9 @@  discard block
 block discarded – undo
887 887
                         assert_equal_xml($xml, $expected);
888 888
 
889 889
                         $xml = new FluidXml();
890
-                        $xml->appendChild([ 'child', ['child'], ['child' => 'value1'], ['child' => 'value2'] ])
890
+                        $xml->appendChild(['child', ['child'], ['child' => 'value1'], ['child' => 'value2']])
891 891
                              ->appendChild('parent', true)
892
-                             ->appendChild([ 'child', ['child'], ['child' => 'value3'], ['child' => 'value4'] ]);
892
+                             ->appendChild(['child', ['child'], ['child' => 'value3'], ['child' => 'value4']]);
893 893
 
894 894
                         $expected = "<doc>\n"
895 895
                                   . "  <child/>\n"
@@ -940,12 +940,12 @@  discard block
 block discarded – undo
940 940
 
941 941
                 it('should add children with some attributes and text using the @ syntax', function() {
942 942
                         $xml = new FluidXml();
943
-                        $attrs = [ '@class' => 'Class attr',
943
+                        $attrs = ['@class' => 'Class attr',
944 944
                                    '@'      => 'Text content',
945
-                                   '@id'    => 'Id attr' ];
946
-                        $xml->appendChild(['child1' => $attrs ])
947
-                            ->appendChild(['child2' => $attrs ], true)
948
-                                ->appendChild(['child3' => $attrs ]);
945
+                                   '@id'    => 'Id attr'];
946
+                        $xml->appendChild(['child1' => $attrs])
947
+                            ->appendChild(['child2' => $attrs], true)
948
+                                ->appendChild(['child3' => $attrs]);
949 949
 
950 950
                         $expected = "<doc>\n"
951 951
                                   . "  <child1 class=\"Class attr\" id=\"Id attr\">Text content</child1>\n"
@@ -1109,8 +1109,8 @@  discard block
 block discarded – undo
1109 1109
                 it('should add many instances', function() use ($doc, $dom) {
1110 1110
                         $fxml = FluidXml::load($dom)->query('/doc/parent');
1111 1111
                         $xml  = new FluidXml();
1112
-                        $xml->appendChild([ $fxml,
1113
-                                            'imported' => $fxml ]);
1112
+                        $xml->appendChild([$fxml,
1113
+                                            'imported' => $fxml]);
1114 1114
 
1115 1115
                         $expected = "<doc>\n"
1116 1116
                                   . "  <parent>content</parent>\n"
@@ -1122,11 +1122,11 @@  discard block
 block discarded – undo
1122 1122
                 });
1123 1123
 
1124 1124
                 it('should throw for not supported input', function() {
1125
-                        $xml  = new FluidXml();
1125
+                        $xml = new FluidXml();
1126 1126
                         try {
1127 1127
                                 $xml->appendChild(0);
1128 1128
                         } catch (\Exception $e) {
1129
-                                $actual   = $e;
1129
+                                $actual = $e;
1130 1130
                         }
1131 1131
 
1132 1132
                         assert_is_a($actual, \Exception::class);
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
                         try {
1873 1873
                                 $cx[] = "value";
1874 1874
                         } catch (\Exception $e) {
1875
-                                $actual   = $e;
1875
+                                $actual = $e;
1876 1876
                         }
1877 1877
                         assert_is_a($actual, \Exception::class);
1878 1878
 
@@ -1985,8 +1985,8 @@  discard block
 block discarded – undo
1985 1985
                         $ns_id   = 'x';
1986 1986
                         $ns_uri  = 'x.com';
1987 1987
                         $ns_mode = FluidNamespace::MODE_EXPLICIT;
1988
-                        $args    = [ FluidNamespace::ID  => $ns_id,
1989
-                                     FluidNamespace::URI => $ns_uri ];
1988
+                        $args    = [FluidNamespace::ID  => $ns_id,
1989
+                                     FluidNamespace::URI => $ns_uri];
1990 1990
                         $ns      = new FluidNamespace($args);
1991 1991
 
1992 1992
                         $actual   = $ns->id();
Please login to merge, or discard this patch.
support/peridot.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
 use Peridot\Reporter\CodeCoverage\AbstractCodeCoverageReporter;
13 13
 use Peridot\Reporter\CodeCoverageReporters;
14 14
 
15
-return function (EventEmitterInterface $eventEmitter) {
15
+return function(EventEmitterInterface $eventEmitter) {
16 16
         (new CodeCoverageReporters($eventEmitter))->register();
17 17
 
18 18
         // $eventEmitter->on('peridot.start', function (\Peridot\Console\Environment $environment) {
19 19
         //         $environment->getDefinition()->getArgument('path')->setDefault(__DIR__ . '/../specs');
20 20
         // });
21 21
 
22
-        $eventEmitter->on('code-coverage.start', function (AbstractCodeCoverageReporter $reporter) {
22
+        $eventEmitter->on('code-coverage.start', function(AbstractCodeCoverageReporter $reporter) {
23 23
                 /*
24 24
                 $reporter->addDirectoryToWhitelist(__DIR__ . '/../source')
25 25
                          ->addFilesToBlacklist([__DIR__ . '/../source/FluidXml.php56.php',
Please login to merge, or discard this patch.
support/speedtest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 $machine = new Codevelox();
9 9
 
10 10
 $fluidxml = 'fluidxml';
11
-if (! function_exists($fluidxml)) {
11
+if (!function_exists($fluidxml)) {
12 12
         $fluidxml = '\FluidXml\fluidxml';
13 13
 }
14 14
 
Please login to merge, or discard this patch.
documents/Examples.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 // $booksheet = FluidXml::new('book', ['stylesheet' => 'http://domain.com/style.xsl']);
36 36
 
37 37
 $book->setAttribute('type', 'science')                  // It sets an attribute of the root node ('book').
38
-     ->appendChild([ 'title'  => 'The Theory Of Everything',
39
-                     'author' => 'S. Hawking' ]);       // It creates two nodes, each one with some text inside.
38
+        ->appendChild([ 'title'  => 'The Theory Of Everything',
39
+                        'author' => 'S. Hawking' ]);       // It creates two nodes, each one with some text inside.
40 40
 
41 41
 echo $book->xml();                                      // Exports the xml document as a string.
42 42
 echo "————————————————————————————————————————————————————————————————————————————————\n";
@@ -83,35 +83,35 @@  discard block
 block discarded – undo
83 83
 $food = fluidxml('food');
84 84
 
85 85
 $food->add('fruit')               // A 'fruit' node with an empty content.
86
-     ->add('fruit', 'orange');    // A 'fruit' node with 'orange' as content.
86
+        ->add('fruit', 'orange');    // A 'fruit' node with 'orange' as content.
87 87
 
88 88
 // A node can have even a bunch of attributes.
89 89
 $food->add('fruit', 'apple', [ 'price' => 'expensive',
90
-                               'color' => 'red' ]);
90
+                                'color' => 'red' ]);
91 91
 
92 92
 // Batch insertion of nodes.
93 93
 $food->add([ 'cake'  => 'Tiramisu',
94
-             'pizza' => 'Margherita' ]);
94
+                'pizza' => 'Margherita' ]);
95 95
 
96 96
 // PHP arrays can't contain identical keys.
97 97
 // But it's still possible to create, in a batch operation, nodes with the same tag.
98 98
 $food->add([ [ 'pasta' => 'Carbonara' ],
99
-             [ 'pasta' => 'Matriciana' ] ]);
99
+                [ 'pasta' => 'Matriciana' ] ]);
100 100
 
101 101
 // A bunch of egg's all with the same price.
102 102
 $food->add([ ['egg'], ['egg'], ['egg'] ], ['price' => '0.25']);
103 103
 
104 104
 // Complex array structures are supported too.
105 105
 $food->add([ 'menu' => [
106
-                 'pasta' => [
107
-                     'spaghetti' => [
108
-                         '@id'      => '123',
109
-                         '@country' => 'Italy',
110
-                         '@'        => 'Spaghetti are an Italian dish...',
106
+                        'pasta' => [
107
+                        'spaghetti' => [
108
+                                '@id'      => '123',
109
+                                '@country' => 'Italy',
110
+                                '@'        => 'Spaghetti are an Italian dish...',
111 111
 
112
-                         'variants' => [
113
-                             'tomato' => [ '@type' => 'vegan' ],
114
-                             'egg'    => [ '@type' => 'vegetarian' ] ]]]]]);
112
+                                'variants' => [
113
+                                'tomato' => [ '@type' => 'vegan' ],
114
+                                'egg'    => [ '@type' => 'vegetarian' ] ]]]]]);
115 115
 
116 116
 echo $food->xml();
117 117
 echo "————————————————————————————————————————————————————————————————————————————————\n";
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 $fluid = fluidxml();
189 189
 
190 190
 $fluid->add($other)                                     // Imports a FluidXml instance.
191
-      ->add([ 'query'     => $fluid->query('//meta'),   // Imports a FluidXml query.
192
-              'dom'       => $dom,                      // Imports a DOMDocument.
193
-              'domnodes'  => $dom->childNodes,          // Imports a DOMNodeList.
194
-              'simplexml' => $simplexml ]);             // Imports a SimpleXMLElement.
191
+        ->add([ 'query'     => $fluid->query('//meta'),   // Imports a FluidXml query.
192
+                'dom'       => $dom,                      // Imports a DOMDocument.
193
+                'domnodes'  => $dom->childNodes,          // Imports a DOMNodeList.
194
+                'simplexml' => $simplexml ]);             // Imports a SimpleXMLElement.
195 195
 
196 196
 
197 197
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 
212 212
 $book->query('//chapter')
213 213
         ->attr('lang', 'en')
214
-     ->query('..')
214
+        ->query('..')
215 215
         ->attr('lang', 'en')
216
-     ->query('../title')
216
+        ->query('../title')
217 217
         ->attr('lang', 'en');
218 218
 
219 219
 /*
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
 
296 296
 $xhtml = fluidns('xhtml', 'http://www.w3.org/1999/xhtml');
297 297
 $book->namespace($xhtml)
298
-     ->namespace('svg', 'http://www.w3.org/2000/svg')
299
-     ->namespace('xsl', 'http://www.w3.org/TR/xsl', FluidNamespace::MODE_IMPLICIT)
300
-     ->add('xhtml:h1')
301
-     ->add([ 'xsl:template'  => [ 'xsl:variable' ] ])
302
-     ->query('//xhtml:h1')
303
-     ->add('svg:shape');
298
+        ->namespace('svg', 'http://www.w3.org/2000/svg')
299
+        ->namespace('xsl', 'http://www.w3.org/TR/xsl', FluidNamespace::MODE_IMPLICIT)
300
+        ->add('xhtml:h1')
301
+        ->add([ 'xsl:template'  => [ 'xsl:variable' ] ])
302
+        ->query('//xhtml:h1')
303
+        ->add('svg:shape');
304 304
 
305 305
 echo $book->xml();
306 306
 echo "————————————————————————————————————————————————————————————————————————————————\n";
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 // $booksheet = FluidXml::new('book', ['stylesheet' => 'http://domain.com/style.xsl']);
36 36
 
37 37
 $book->setAttribute('type', 'science')                  // It sets an attribute of the root node ('book').
38
-     ->appendChild([ 'title'  => 'The Theory Of Everything',
39
-                     'author' => 'S. Hawking' ]);       // It creates two nodes, each one with some text inside.
38
+     ->appendChild(['title'  => 'The Theory Of Everything',
39
+                     'author' => 'S. Hawking']); // It creates two nodes, each one with some text inside.
40 40
 
41
-echo $book->xml();                                      // Exports the xml document as a string.
41
+echo $book->xml(); // Exports the xml document as a string.
42 42
 echo "————————————————————————————————————————————————————————————————————————————————\n";
43 43
 
44 44
 
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 */
60 60
 
61 61
 $book->appendChild('chapters', true)                     // true forces the return of the 'chapters' node.
62
-        ->appendChild('chapter', 'Ideas About The Universe',    ['id' => 123, 'first' => ''])
63
-        ->appendChild('chapter', 'The Expanding Universe',      ['id' => 321])
64
-        ->appendChild('chapter', 'Black Holes',                 ['id' => 432])
62
+        ->appendChild('chapter', 'Ideas About The Universe', ['id' => 123, 'first' => ''])
63
+        ->appendChild('chapter', 'The Expanding Universe', ['id' => 321])
64
+        ->appendChild('chapter', 'Black Holes', ['id' => 432])
65 65
         ->appendChild('chapter', 'Black Holes Ain\'t So Black', ['id' =>234]);
66 66
 
67 67
 
@@ -83,26 +83,26 @@  discard block
 block discarded – undo
83 83
 $food = fluidxml('food');
84 84
 
85 85
 $food->add('fruit')               // A 'fruit' node with an empty content.
86
-     ->add('fruit', 'orange');    // A 'fruit' node with 'orange' as content.
86
+     ->add('fruit', 'orange'); // A 'fruit' node with 'orange' as content.
87 87
 
88 88
 // A node can have even a bunch of attributes.
89
-$food->add('fruit', 'apple', [ 'price' => 'expensive',
90
-                               'color' => 'red' ]);
89
+$food->add('fruit', 'apple', ['price' => 'expensive',
90
+                               'color' => 'red']);
91 91
 
92 92
 // Batch insertion of nodes.
93
-$food->add([ 'cake'  => 'Tiramisu',
94
-             'pizza' => 'Margherita' ]);
93
+$food->add(['cake'  => 'Tiramisu',
94
+             'pizza' => 'Margherita']);
95 95
 
96 96
 // PHP arrays can't contain identical keys.
97 97
 // But it's still possible to create, in a batch operation, nodes with the same tag.
98
-$food->add([ [ 'pasta' => 'Carbonara' ],
99
-             [ 'pasta' => 'Matriciana' ] ]);
98
+$food->add([['pasta' => 'Carbonara'],
99
+             ['pasta' => 'Matriciana']]);
100 100
 
101 101
 // A bunch of egg's all with the same price.
102
-$food->add([ ['egg'], ['egg'], ['egg'] ], ['price' => '0.25']);
102
+$food->add([['egg'], ['egg'], ['egg']], ['price' => '0.25']);
103 103
 
104 104
 // Complex array structures are supported too.
105
-$food->add([ 'menu' => [
105
+$food->add(['menu' => [
106 106
                  'pasta' => [
107 107
                      'spaghetti' => [
108 108
                          '@id'      => '123',
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
                          '@'        => 'Spaghetti are an Italian dish...',
111 111
 
112 112
                          'variants' => [
113
-                             'tomato' => [ '@type' => 'vegan' ],
114
-                             'egg'    => [ '@type' => 'vegetarian' ] ]]]]]);
113
+                             'tomato' => ['@type' => 'vegan'],
114
+                             'egg'    => ['@type' => 'vegetarian']]]]]]);
115 115
 
116 116
 echo $food->xml();
117 117
 echo "————————————————————————————————————————————————————————————————————————————————\n";
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 $fluid = fluidxml();
189 189
 
190 190
 $fluid->add($other)                                     // Imports a FluidXml instance.
191
-      ->add([ 'query'     => $fluid->query('//meta'),   // Imports a FluidXml query.
192
-              'dom'       => $dom,                      // Imports a DOMDocument.
193
-              'domnodes'  => $dom->childNodes,          // Imports a DOMNodeList.
194
-              'simplexml' => $simplexml ]);             // Imports a SimpleXMLElement.
191
+      ->add(['query'     => $fluid->query('//meta'), // Imports a FluidXml query.
192
+              'dom'       => $dom, // Imports a DOMDocument.
193
+              'domnodes'  => $dom->childNodes, // Imports a DOMNodeList.
194
+              'simplexml' => $simplexml]); // Imports a SimpleXMLElement.
195 195
 
196 196
 
197 197
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 /*
279 279
 * To retrieve all DOMNode in one operation there is the ->asArray() method.
280 280
 */
281
-$chapters_nodes = $chapters->asArray();          // Returns an array of DOMNode.
281
+$chapters_nodes = $chapters->asArray(); // Returns an array of DOMNode.
282 282
 
283 283
 echo "————————————————————————————————————————————————————————————————————————————————\n";
284 284
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      ->namespace('svg', 'http://www.w3.org/2000/svg')
299 299
      ->namespace('xsl', 'http://www.w3.org/TR/xsl', FluidNamespace::MODE_IMPLICIT)
300 300
      ->add('xhtml:h1')
301
-     ->add([ 'xsl:template'  => [ 'xsl:variable' ] ])
301
+     ->add(['xsl:template'  => ['xsl:variable']])
302 302
      ->query('//xhtml:h1')
303 303
      ->add('svg:shape');
304 304
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
  * Removing Nodes. *
312 312
  *******************/
313 313
 
314
-$food->remove('//egg');     // Removes all the eggs.
314
+$food->remove('//egg'); // Removes all the eggs.
315 315
 
316 316
 // Which is the same of
317 317
 // $food->query('//egg')->remove();     // Removes all the eggs using a query.
Please login to merge, or discard this patch.