Passed
Push — master ( c01fee...eeab5f )
by Daniele
02:33
created
source/FluidXml/FluidAliasesTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
4 4
 
5 5
 trait FluidAliasesTrait
6 6
 {
7
-        public function size()                           { return $this->length(); }
8
-        public function __invoke(...$query)              { return $this->query(...$query); }
9
-        public function add($child, ...$optionals)       { return $this->addChild($child, ...$optionals); }
7
+        public function size() { return $this->length(); }
8
+        public function __invoke(...$query) { return $this->query(...$query); }
9
+        public function add($child, ...$optionals) { return $this->addChild($child, ...$optionals); }
10 10
         public function prepend($sibling, ...$optionals) { return $this->prependSibling($sibling, ...$optionals); }
11
-        public function append($sibling, ...$optionals)  { return $this->appendSibling($sibling, ...$optionals); }
12
-        public function attr($name, $value = null)       { return $this->setAttribute($name, $value); }
13
-        public function text($text)                      { return $this->setText($text); }
14
-        public function cdata($text)                     { return $this->setCdata($text); }
15
-        public function comment($text)                   { return $this->setComment($text); }
11
+        public function append($sibling, ...$optionals) { return $this->appendSibling($sibling, ...$optionals); }
12
+        public function attr($name, $value = null) { return $this->setAttribute($name, $value); }
13
+        public function text($text) { return $this->setText($text); }
14
+        public function cdata($text) { return $this->setCdata($text); }
15
+        public function comment($text) { return $this->setComment($text); }
16 16
         abstract public function length();
17 17
         abstract public function query(...$query);
18 18
         abstract public function addChild($child, ...$optionals);
Please login to merge, or discard this patch.
source/FluidXml/FluidContext.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
         use FluidAliasesTrait,
11 11
             FluidSaveTrait,
12 12
             NewableTrait,
13
-            ReservedCallTrait,          // For compatibility with PHP 5.6.
14
-            ReservedCallStaticTrait;    // For compatibility with PHP 5.6.
13
+            ReservedCallTrait, // For compatibility with PHP 5.6.
14
+            ReservedCallStaticTrait; // For compatibility with PHP 5.6.
15 15
 
16 16
         private $document;
17 17
         private $handler;
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
                 $this->document = $document;
24 24
                 $this->handler  = $handler;
25 25
 
26
-                if (! \is_array($context) && ! $context instanceof \Traversable) {
26
+                if (!\is_array($context) && !$context instanceof \Traversable) {
27 27
                         // DOMDocument, DOMElement and DOMNode are not iterable.
28 28
                         // DOMNodeList and FluidContext are iterable.
29
-                        $context = [ $context ];
29
+                        $context = [$context];
30 30
                 }
31 31
 
32 32
                 foreach ($context as $n) {
33
-                        if (! $n instanceof \DOMNode) {
33
+                        if (!$n instanceof \DOMNode) {
34 34
                                 throw new \Exception('Node type not recognized.');
35 35
                         }
36 36
 
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
         // addChild($child, $value?, $attributes? = [], $switchContext? = false)
200 200
         public function addChild($child, ...$optionals)
201 201
         {
202
-                return $this->handler->insertElement($this->nodes, $child, $optionals, function ($parent, $element) {
202
+                return $this->handler->insertElement($this->nodes, $child, $optionals, function($parent, $element) {
203 203
                         return $parent->appendChild($element);
204 204
                 }, $this);
205 205
         }
206 206
 
207 207
         public function prependSibling($sibling, ...$optionals)
208 208
         {
209
-                return $this->handler->insertElement($this->nodes, $sibling, $optionals, function ($sibling, $element) {
209
+                return $this->handler->insertElement($this->nodes, $sibling, $optionals, function($sibling, $element) {
210 210
                         if ($sibling->parentNode === null) {
211 211
                                 // If the node doesn't have at least one parent node,
212 212
                                 // the sibling creation fails. In this case we replace
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
         public function appendSibling($sibling, ...$optionals)
223 223
         {
224
-                return $this->handler->insertElement($this->nodes, $sibling, $optionals, function ($sibling, $element) {
224
+                return $this->handler->insertElement($this->nodes, $sibling, $optionals, function($sibling, $element) {
225 225
                         if ($sibling->parentNode === null) {
226 226
                                 // If the node doesn't have at least one parent node,
227 227
                                 // the sibling creation fails. In this case we replace
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         // setAttribute(['name' => 'value', ...])
240 240
         public function setAttribute($name, $value = null)
241 241
         {
242
-                $attrs = [ $name => $value ];
242
+                $attrs = [$name => $value];
243 243
 
244 244
                 if (\is_array($name)) {
245 245
                         $attrs = $name;
@@ -394,10 +394,10 @@  discard block
 block discarded – undo
394 394
 
395 395
         protected function resolveQuery($query)
396 396
         {
397
-                if ( $query === '.'
397
+                if ($query === '.'
398 398
                      || $query[0] === '/'
399
-                     || ( $query[0] === '.' && $query[1] === '/' )
400
-                     || ( $query[0] === '.' && $query[1] === '.' ) ) {
399
+                     || ($query[0] === '.' && $query[1] === '/')
400
+                     || ($query[0] === '.' && $query[1] === '.')) {
401 401
                         return $query;
402 402
                 }
403 403
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
                                 $found = ($r === $u) || $found;
416 416
                         }
417 417
 
418
-                        if (! $found) {
418
+                        if (!$found) {
419 419
                                 $set[] = $r;
420 420
                         }
421 421
                 }
Please login to merge, or discard this patch.
source/FluidXml/FluidInsertionHandler.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
         {
13 13
                 $this->document   = $document;
14 14
                 $this->dom        = $document->dom;
15
-                $this->namespaces =& $document->namespaces;
15
+                $this->namespaces = & $document->namespaces;
16 16
         }
17 17
 
18 18
         public function insertElement(&$nodes, $element, &$optionals, $fn, $orig_context)
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                 // offers to the user and is the same of:
35 35
                 // 1. appending a child switching the context
36 36
                 // 2. setting the attributes over the new context.
37
-                if (! empty($attributes)) {
37
+                if (!empty($attributes)) {
38 38
                         $new_context->setAttribute($attributes);
39 39
                 }
40 40
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 
49 49
         protected function handleOptionals($element, &$optionals)
50 50
         {
51
-                if (! \is_array($element)) {
52
-                        $element = [ $element ];
51
+                if (!\is_array($element)) {
52
+                        $element = [$element];
53 53
                 }
54 54
 
55 55
                 $switch_context = false;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                         }
69 69
                 }
70 70
 
71
-                return [ $element, $attributes, $switch_context ];
71
+                return [$element, $attributes, $switch_context];
72 72
         }
73 73
 
74 74
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         protected function recognizeStringMixed($k, $v)
97 97
         {
98
-                if (! \is_string($k)) {
98
+                if (!\is_string($k)) {
99 99
                         return;
100 100
                 }
101 101
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                 }
108 108
 
109 109
                 if (\is_string($v)) {
110
-                        if (! FluidHelper::isAnXmlString($v)) {
110
+                        if (!FluidHelper::isAnXmlString($v)) {
111 111
                                 return 'insertStringSimple';
112 112
                         }
113 113
                 } else {
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 
207 207
         protected function attachNodes($parent, $nodes, $fn)
208 208
         {
209
-                if (! \is_array($nodes) && ! $nodes instanceof \Traversable) {
210
-                        $nodes = [ $nodes ];
209
+                if (!\is_array($nodes) && !$nodes instanceof \Traversable) {
210
+                        $nodes = [$nodes];
211 211
                 }
212 212
 
213 213
                 $context = [];
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
                 $el = $this->createElement($k, $v);
257 257
                 $el = $fn($parent, $el);
258 258
 
259
-                return [ $el ];
259
+                return [$el];
260 260
         }
261 261
 
262 262
         protected function insertStringMixed($parent, $k, $v, $fn, &$optionals)
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                 // they are supplied, so 'addChild' is the perfect operation.
274 274
                 $this->newContext($el)->addChild($v, ...$optionals);
275 275
 
276
-                return [ $el ];
276
+                return [$el];
277 277
         }
278 278
 
279 279
         protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals)
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
                 $el = $this->createElement($v);
301 301
                 $el = $fn($parent, $el);
302 302
 
303
-                return [ $el ];
303
+                return [$el];
304 304
         }
305 305
 
306 306
         protected function insertIntegerXml($parent, $k, $v, $fn)
Please login to merge, or discard this patch.
source/FluidXml/FluidXml.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@  discard block
 block discarded – undo
10 10
         use FluidAliasesTrait,
11 11
             FluidSaveTrait,
12 12
             NewableTrait,
13
-            ReservedCallTrait,          // For compatibility with PHP 5.6.
14
-            ReservedCallStaticTrait;    // For compatibility with PHP 5.6.
13
+            ReservedCallTrait, // For compatibility with PHP 5.6.
14
+            ReservedCallStaticTrait; // For compatibility with PHP 5.6.
15 15
 
16 16
         const ROOT_NODE = 'doc';
17 17
 
18
-        private $defaults = [ 'root'       => self::ROOT_NODE,
18
+        private $defaults = ['root'       => self::ROOT_NODE,
19 19
                               'version'    => '1.0',
20 20
                               'encoding'   => 'UTF-8',
21
-                              'stylesheet' => null ];
21
+                              'stylesheet' => null];
22 22
 
23 23
         private $document;
24 24
         private $handler;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
                 $document = \file_get_contents($file);
32 32
 
33 33
                 // file_get_contents() returns false in case of error.
34
-                if (! $document) {
34
+                if (!$document) {
35 35
                         throw new \Exception("File '$file' not accessible.");
36 36
                 }
37 37
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         private function initStylesheet(&$options)
97 97
         {
98
-                if (! empty($options['stylesheet'])) {
98
+                if (!empty($options['stylesheet'])) {
99 99
                         $attrs = 'type="text/xsl" '
100 100
                                . "encoding=\"{$options['encoding']}\" "
101 101
                                . 'indent="yes" '
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
         private function initRoot(&$options)
117 117
         {
118
-                if (! empty($options['root'])) {
118
+                if (!empty($options['root'])) {
119 119
                         $this->appendSibling($options['root']);
120 120
                 }
121 121
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                         $el = $this->document->dom;
144 144
                 }
145 145
 
146
-                return [ $el ];
146
+                return [$el];
147 147
         }
148 148
 
149 149
         public function __toString()
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                 $namespaces = [];
187 187
 
188 188
                 if (\is_string($arguments[0])) {
189
-                        $args = [ $arguments[0], $arguments[1] ];
189
+                        $args = [$arguments[0], $arguments[1]];
190 190
 
191 191
                         if (isset($arguments[2])) {
192 192
                                 $args[] = $arguments[2];
@@ -207,18 +207,18 @@  discard block
 block discarded – undo
207 207
                 return $this;
208 208
         }
209 209
 
210
-        public function query(...$query)                   { return $this->context()->query(...$query); }
210
+        public function query(...$query) { return $this->context()->query(...$query); }
211 211
         public function times($times, callable $fn = null) { return $this->context()->times($times, $fn); }
212
-        public function each(callable $fn)                 { return $this->context()->each($fn); }
213
-        public function filter(callable $fn)               { return $this->context()->filter($fn); }
212
+        public function each(callable $fn) { return $this->context()->each($fn); }
213
+        public function filter(callable $fn) { return $this->context()->filter($fn); }
214 214
         public function setAttribute($name, $value = null) { $this->context()->setAttribute($name, $value); return $this; }
215
-        public function setText($text)                     { $this->context()->setText($text);    return $this; }
216
-        public function addText($text)                     { $this->context()->addText($text);    return $this; }
217
-        public function setCdata($text)                    { $this->context()->setCdata($text);   return $this; }
218
-        public function addCdata($text)                    { $this->context()->addCdata($text);   return $this; }
219
-        public function setComment($text)                  { $this->context()->setComment($text); return $this; }
220
-        public function addComment($text)                  { $this->context()->addComment($text); return $this; }
221
-        public function remove(...$query)                  { $this->context()->remove(...$query); return $this; }
215
+        public function setText($text) { $this->context()->setText($text); return $this; }
216
+        public function addText($text) { $this->context()->addText($text); return $this; }
217
+        public function setCdata($text) { $this->context()->setCdata($text); return $this; }
218
+        public function addCdata($text) { $this->context()->addCdata($text); return $this; }
219
+        public function setComment($text) { $this->context()->setComment($text); return $this; }
220
+        public function addComment($text) { $this->context()->addComment($text); return $this; }
221
+        public function remove(...$query) { $this->context()->remove(...$query); return $this; }
222 222
 
223 223
         public function addChild($child, ...$optionals)
224 224
         {
Please login to merge, or discard this patch.