@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | { |
| 10 | 10 | use NewableTrait, |
| 11 | 11 | FluidSaveTrait, |
| 12 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
| 13 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
| 12 | + ReservedCallTrait, // For compatibility with PHP 5.6. |
|
| 13 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
| 14 | 14 | |
| 15 | 15 | private $document; |
| 16 | 16 | private $handler; |
@@ -22,14 +22,14 @@ discard block |
||
| 22 | 22 | $this->document = $document; |
| 23 | 23 | $this->handler = $handler; |
| 24 | 24 | |
| 25 | - if (! \is_array($context) && ! $context instanceof \Traversable) { |
|
| 25 | + if (!\is_array($context) && !$context instanceof \Traversable) { |
|
| 26 | 26 | // DOMDocument, DOMElement and DOMNode are not iterable. |
| 27 | 27 | // DOMNodeList and FluidContext are iterable. |
| 28 | - $context = [ $context ]; |
|
| 28 | + $context = [$context]; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | foreach ($context as $n) { |
| 32 | - if (! $n instanceof \DOMNode) { |
|
| 32 | + if (!$n instanceof \DOMNode) { |
|
| 33 | 33 | throw new \Exception('Node type not recognized.'); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | // addChild($child, $value?, $attributes? = [], $switchContext? = false) |
| 205 | 205 | public function addChild($child, ...$optionals) |
| 206 | 206 | { |
| 207 | - return $this->handler->insertElement($this->nodes, $child, $optionals, function ($parent, $element) { |
|
| 207 | + return $this->handler->insertElement($this->nodes, $child, $optionals, function($parent, $element) { |
|
| 208 | 208 | return $parent->appendChild($element); |
| 209 | 209 | }, $this); |
| 210 | 210 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | public function prependSibling($sibling, ...$optionals) |
| 219 | 219 | { |
| 220 | - return $this->handler->insertElement($this->nodes, $sibling, $optionals, function ($sibling, $element) { |
|
| 220 | + return $this->handler->insertElement($this->nodes, $sibling, $optionals, function($sibling, $element) { |
|
| 221 | 221 | return $sibling->parentNode->insertBefore($element, $sibling); |
| 222 | 222 | }, $this); |
| 223 | 223 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | public function appendSibling($sibling, ...$optionals) |
| 232 | 232 | { |
| 233 | - return $this->handler->insertElement($this->nodes, $sibling, $optionals, function ($sibling, $element) { |
|
| 233 | + return $this->handler->insertElement($this->nodes, $sibling, $optionals, function($sibling, $element) { |
|
| 234 | 234 | // If ->nextSibling is null, $element is simply appended as last sibling. |
| 235 | 235 | return $sibling->parentNode->insertBefore($element, $sibling->nextSibling); |
| 236 | 236 | }, $this); |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | // the user has passed two arguments: |
| 256 | 256 | // 1. is the attribute name |
| 257 | 257 | // 2. is the attribute value |
| 258 | - if (! \is_array($arguments[0])) { |
|
| 259 | - $val = isset($arguments[1]) ? $arguments[1]: ''; |
|
| 258 | + if (!\is_array($arguments[0])) { |
|
| 259 | + $val = isset($arguments[1]) ? $arguments[1] : ''; |
|
| 260 | 260 | $attrs = [$arguments[0] => $val]; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -433,10 +433,10 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | protected function resolveQuery($query) |
| 435 | 435 | { |
| 436 | - if ( $query === '.' |
|
| 436 | + if ($query === '.' |
|
| 437 | 437 | || $query[0] === '/' |
| 438 | - || ( $query[0] === '.' && $query[1] === '/' ) |
|
| 439 | - || ( $query[0] === '.' && $query[1] === '.' ) ) { |
|
| 438 | + || ($query[0] === '.' && $query[1] === '/') |
|
| 439 | + || ($query[0] === '.' && $query[1] === '.')) { |
|
| 440 | 440 | return $query; |
| 441 | 441 | } |
| 442 | 442 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $found = ($r === $u) || $found; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - if (! $found) { |
|
| 457 | + if (!$found) { |
|
| 458 | 458 | $set[] = $r; |
| 459 | 459 | } |
| 460 | 460 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | throw new \Exception("Optional argument '$opt' not recognized."); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - return [ $element, $attributes, $switch_context ]; |
|
| 79 | + return [$element, $attributes, $switch_context]; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | protected function handleStringMixed($parent, $k, $v, $fn, &$optionals, &$status) |
| 106 | 106 | { |
| 107 | - if (! \is_string($k)) { |
|
| 107 | + if (!\is_string($k)) { |
|
| 108 | 108 | return; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | } else { |
| 120 | 120 | if (\is_string($v)) { |
| 121 | - if (! FluidHelper::isAnXmlString($v)) { |
|
| 121 | + if (!FluidHelper::isAnXmlString($v)) { |
|
| 122 | 122 | $handler = 'insertStringSimple'; |
| 123 | 123 | } |
| 124 | 124 | } else { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | protected function handleIntegerMixed($parent, $k, $v, $fn, &$optionals, &$status) |
| 136 | 136 | { |
| 137 | - if (! \is_integer($k)) { |
|
| 137 | + if (!\is_integer($k)) { |
|
| 138 | 138 | return; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | protected function handleDocuments($parent, $k, $v, $fn, &$optionals, &$status) |
| 160 | 160 | { |
| 161 | - if (! \is_integer($k)) { |
|
| 161 | + if (!\is_integer($k)) { |
|
| 162 | 162 | return; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -226,8 +226,8 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | protected function attachNodes($parent, $nodes, $fn) |
| 228 | 228 | { |
| 229 | - if (! \is_array($nodes) && ! $nodes instanceof \Traversable) { |
|
| 230 | - $nodes = [ $nodes ]; |
|
| 229 | + if (!\is_array($nodes) && !$nodes instanceof \Traversable) { |
|
| 230 | + $nodes = [$nodes]; |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | $context = []; |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $el = $this->createElement($k, $v); |
| 277 | 277 | $el = $fn($parent, $el); |
| 278 | 278 | |
| 279 | - return [ $el ]; |
|
| 279 | + return [$el]; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | protected function insertStringMixed($parent, $k, $v, $fn, &$optionals) |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | // they are supplied, so 'addChild' is the perfect operation. |
| 294 | 294 | $this->newContext($el)->addChild($v, ...$optionals); |
| 295 | 295 | |
| 296 | - return [ $el ]; |
|
| 296 | + return [$el]; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals) |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $el = $this->createElement($v); |
| 321 | 321 | $el = $fn($parent, $el); |
| 322 | 322 | |
| 323 | - return [ $el ]; |
|
| 323 | + return [$el]; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | protected function insertIntegerXml($parent, $k, $v, $fn) |