Completed
Branch master (ae8dd7)
by Daniele
07:55
created
specs/FluidXml.php 1 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.
source/FluidXml.php 1 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/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 1 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.