@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | class FluidXml implements FluidInterface |
138 | 138 | { |
139 | 139 | use NewableTrait, |
140 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
141 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
140 | + ReservedCallTrait, // For compatibility with PHP 5.6. |
|
141 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
142 | 142 | |
143 | 143 | const ROOT_NODE = 'doc'; |
144 | 144 | |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | |
148 | 148 | public static function load($document) |
149 | 149 | { |
150 | - if (\is_string($document) && ! is_an_xml_string($document)) { |
|
150 | + if (\is_string($document) && !is_an_xml_string($document)) { |
|
151 | 151 | $file = $document; |
152 | 152 | $document = \file_get_contents($file); |
153 | 153 | |
154 | 154 | // file_get_contents returns false if it can't read. |
155 | - if (! $document) { |
|
155 | + if (!$document) { |
|
156 | 156 | throw new \Exception("File '$file' not accessible."); |
157 | 157 | } |
158 | 158 | } |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | |
163 | 163 | public function __construct($root = null, $options = []) |
164 | 164 | { |
165 | - $defaults = [ 'root' => self::ROOT_NODE, |
|
165 | + $defaults = ['root' => self::ROOT_NODE, |
|
166 | 166 | 'version' => '1.0', |
167 | 167 | 'encoding' => 'UTF-8', |
168 | - 'stylesheet' => null ]; |
|
168 | + 'stylesheet' => null]; |
|
169 | 169 | |
170 | 170 | if (\is_string($root)) { |
171 | 171 | // The root option can be specified as first argument |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | |
191 | 191 | $this->handler = new FluidInsertionHandler($doc); |
192 | 192 | |
193 | - if (! empty($opts['root'])) { |
|
193 | + if (!empty($opts['root'])) { |
|
194 | 194 | $this->appendSibling($opts['root']); |
195 | 195 | } |
196 | 196 | |
197 | - if (! empty($opts['stylesheet'])) { |
|
197 | + if (!empty($opts['stylesheet'])) { |
|
198 | 198 | $attrs = 'type="text/xsl" ' |
199 | 199 | . "encoding=\"{$opts['encoding']}\" " |
200 | 200 | . 'indent="yes" ' |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $namespaces = []; |
233 | 233 | |
234 | 234 | if (\is_string($arguments[0])) { |
235 | - $args = [ $arguments[0], $arguments[1] ]; |
|
235 | + $args = [$arguments[0], $arguments[1]]; |
|
236 | 236 | |
237 | 237 | if (isset($arguments[2])) { |
238 | 238 | $args[] = $arguments[2]; |
@@ -435,16 +435,16 @@ discard block |
||
435 | 435 | |
436 | 436 | class FluidNamespace |
437 | 437 | { |
438 | - const ID = 'id' ; |
|
439 | - const URI = 'uri' ; |
|
438 | + const ID = 'id'; |
|
439 | + const URI = 'uri'; |
|
440 | 440 | const MODE = 'mode'; |
441 | 441 | |
442 | 442 | const MODE_IMPLICIT = 0; |
443 | 443 | const MODE_EXPLICIT = 1; |
444 | 444 | |
445 | - private $config = [ self::ID => '', |
|
445 | + private $config = [self::ID => '', |
|
446 | 446 | self::URI => '', |
447 | - self::MODE => self::MODE_EXPLICIT ]; |
|
447 | + self::MODE => self::MODE_EXPLICIT]; |
|
448 | 448 | |
449 | 449 | public function __construct($id, $uri, $mode = 1) |
450 | 450 | { |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | { |
483 | 483 | $id = $this->id(); |
484 | 484 | |
485 | - if (! empty($id)) { |
|
485 | + if (!empty($id)) { |
|
486 | 486 | $id .= ':'; |
487 | 487 | } |
488 | 488 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $nodes = \explode('/', $xpath); |
494 | 494 | |
495 | 495 | foreach ($nodes as $node) { |
496 | - if (! empty($node)) { |
|
496 | + if (!empty($node)) { |
|
497 | 497 | // An XPath query can have multiple slashes. |
498 | 498 | // Example: //target |
499 | 499 | $new_xpath .= "{$id}{$node}"; |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | { |
671 | 671 | $this->document = $document; |
672 | 672 | $this->dom = $document->dom; |
673 | - $this->namespaces =& $document->namespaces; |
|
673 | + $this->namespaces = & $document->namespaces; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | public function insertElement(&$nodes, $element, &$optionals, $fn, $orig_context) |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | // offers to the user and is the same of: |
693 | 693 | // 1. appending a child switching the context |
694 | 694 | // 2. setting the attributes over the new context. |
695 | - if (! empty($attributes)) { |
|
695 | + if (!empty($attributes)) { |
|
696 | 696 | $new_context->setAttribute($attributes); |
697 | 697 | } |
698 | 698 | |
@@ -706,8 +706,8 @@ discard block |
||
706 | 706 | |
707 | 707 | protected function handleOptionals($element, &$optionals) |
708 | 708 | { |
709 | - if (! \is_array($element)) { |
|
710 | - $element = [ $element ]; |
|
709 | + if (!\is_array($element)) { |
|
710 | + $element = [$element]; |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | $switch_context = false; |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | } |
731 | 731 | } |
732 | 732 | |
733 | - return [ $element, $attributes, $switch_context ]; |
|
733 | + return [$element, $attributes, $switch_context]; |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | |
@@ -751,9 +751,9 @@ discard block |
||
751 | 751 | $v_is_string = \is_string($v); |
752 | 752 | $v_is_xml = $v_is_string && is_an_xml_string($v); |
753 | 753 | $k_is_special = $k_is_string && $k[0] === '@'; |
754 | - $k_isnt_special = ! $k_is_special; |
|
755 | - $v_isnt_string = ! $v_is_string; |
|
756 | - $v_isnt_xml = ! $v_is_xml; |
|
754 | + $k_isnt_special = !$k_is_special; |
|
755 | + $v_isnt_string = !$v_is_string; |
|
756 | + $v_isnt_xml = !$v_is_xml; |
|
757 | 757 | /////////////////////////////////////////////////////// |
758 | 758 | |
759 | 759 | if ($k_is_string && $k_isnt_special && $v_is_string && $v_isnt_xml) { |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | } |
774 | 774 | |
775 | 775 | ///////////////////////////////////////////////////// |
776 | - $k_is_special_a = $k_is_special && ! $k_is_special_c; |
|
776 | + $k_is_special_a = $k_is_special && !$k_is_special_c; |
|
777 | 777 | ///////////////////////////////////////////////////// |
778 | 778 | |
779 | 779 | if ($k_is_special_a && $v_is_string) { |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | $v_is_domnode = $v instanceof \DOMNode; |
826 | 826 | /////////////////////////////////////// |
827 | 827 | |
828 | - if ($k_is_integer && ! $v_is_domdoc && $v_is_domnode) { |
|
828 | + if ($k_is_integer && !$v_is_domdoc && $v_is_domnode) { |
|
829 | 829 | return $this->insertIntegerDomnode($parent, $k, $v, $fn, $optionals); |
830 | 830 | } |
831 | 831 | |
@@ -893,8 +893,8 @@ discard block |
||
893 | 893 | |
894 | 894 | protected function attachNodes($parent, $nodes, $fn) |
895 | 895 | { |
896 | - if (! \is_array($nodes) && ! $nodes instanceof \Traversable) { |
|
897 | - $nodes = [ $nodes ]; |
|
896 | + if (!\is_array($nodes) && !$nodes instanceof \Traversable) { |
|
897 | + $nodes = [$nodes]; |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | $context = []; |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | $el = $this->createElement($k, $v); |
944 | 944 | $el = $fn($parent, $el); |
945 | 945 | |
946 | - return [ $el ]; |
|
946 | + return [$el]; |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | protected function insertStringMixed($parent, $k, $v, $fn, &$optionals) |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | // they are supplied, so 'appendChild' is the perfect operation. |
960 | 960 | $this->newContext($el)->appendChild($v, ...$optionals); |
961 | 961 | |
962 | - return [ $el ]; |
|
962 | + return [$el]; |
|
963 | 963 | } |
964 | 964 | |
965 | 965 | protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals) |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | $el = $this->createElement($v); |
987 | 987 | $el = $fn($parent, $el); |
988 | 988 | |
989 | - return [ $el ]; |
|
989 | + return [$el]; |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | protected function insertIntegerXml($parent, $k, $v, $fn) |
@@ -1058,8 +1058,8 @@ discard block |
||
1058 | 1058 | class FluidContext implements FluidInterface, \ArrayAccess, \Iterator |
1059 | 1059 | { |
1060 | 1060 | use NewableTrait, |
1061 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
1062 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
1061 | + ReservedCallTrait, // For compatibility with PHP 5.6. |
|
1062 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
1063 | 1063 | |
1064 | 1064 | private $document; |
1065 | 1065 | private $handler; |
@@ -1071,14 +1071,14 @@ discard block |
||
1071 | 1071 | $this->document = $document; |
1072 | 1072 | $this->handler = $handler; |
1073 | 1073 | |
1074 | - if (! \is_array($context) && ! $context instanceof \Traversable) { |
|
1074 | + if (!\is_array($context) && !$context instanceof \Traversable) { |
|
1075 | 1075 | // DOMDocument, DOMElement and DOMNode are not iterable. |
1076 | 1076 | // DOMNodeList and FluidContext are iterable. |
1077 | - $context = [ $context ]; |
|
1077 | + $context = [$context]; |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | foreach ($context as $n) { |
1081 | - if (! $n instanceof \DOMNode) { |
|
1081 | + if (!$n instanceof \DOMNode) { |
|
1082 | 1082 | throw new \Exception('Node type not recognized.'); |
1083 | 1083 | } |
1084 | 1084 | |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | // the user has passed two arguments: |
1290 | 1290 | // 1. is the attribute name |
1291 | 1291 | // 2. is the attribute value |
1292 | - if (! \is_array($arguments[0])) { |
|
1292 | + if (!\is_array($arguments[0])) { |
|
1293 | 1293 | $attrs = [$arguments[0] => $arguments[1]]; |
1294 | 1294 | } |
1295 | 1295 | |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | $found = ($r === $u) || $found; |
1423 | 1423 | } |
1424 | 1424 | |
1425 | - if (! $found) { |
|
1425 | + if (!$found) { |
|
1426 | 1426 | $set[] = $r; |
1427 | 1427 | } |
1428 | 1428 | } |