@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | class FluidXml implements FluidInterface |
134 | 134 | { |
135 | 135 | use NewableTrait, |
136 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
137 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
136 | + ReservedCallTrait, // For compatibility with PHP 5.6. |
|
137 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
138 | 138 | |
139 | 139 | const ROOT_NODE = 'doc'; |
140 | 140 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | public static function load($document) |
144 | 144 | { |
145 | - if (\is_string($document) && ! is_an_xml_string($document)) { |
|
145 | + if (\is_string($document) && !is_an_xml_string($document)) { |
|
146 | 146 | // Removes any empty new line at the beginning, |
147 | 147 | // otherwise the first character check fails. |
148 | 148 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $document = \file_get_contents($file); |
155 | 155 | } |
156 | 156 | |
157 | - if (! $is_file || ! $is_readable || ! $document) { |
|
157 | + if (!$is_file || !$is_readable || !$document) { |
|
158 | 158 | throw new \Exception("File '$file' not accessible."); |
159 | 159 | } |
160 | 160 | } |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | $this->document = new FluidDocument(); |
168 | 168 | $doc = $this->document; |
169 | 169 | |
170 | - $defaults = [ 'root' => self::ROOT_NODE, |
|
170 | + $defaults = ['root' => self::ROOT_NODE, |
|
171 | 171 | 'version' => '1.0', |
172 | 172 | 'encoding' => 'UTF-8', |
173 | - 'stylesheet' => null ]; |
|
173 | + 'stylesheet' => null]; |
|
174 | 174 | |
175 | 175 | if (\is_string($root)) { |
176 | 176 | // The root option can be specified as first argument |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | |
191 | 191 | $doc->xpath = new \DOMXPath($doc->dom); |
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]; |
@@ -439,16 +439,16 @@ discard block |
||
439 | 439 | |
440 | 440 | class FluidNamespace |
441 | 441 | { |
442 | - const ID = 'id' ; |
|
443 | - const URI = 'uri' ; |
|
442 | + const ID = 'id'; |
|
443 | + const URI = 'uri'; |
|
444 | 444 | const MODE = 'mode'; |
445 | 445 | |
446 | 446 | const MODE_IMPLICIT = 0; |
447 | 447 | const MODE_EXPLICIT = 1; |
448 | 448 | |
449 | - private $config = [ self::ID => '', |
|
449 | + private $config = [self::ID => '', |
|
450 | 450 | self::URI => '', |
451 | - self::MODE => self::MODE_EXPLICIT ]; |
|
451 | + self::MODE => self::MODE_EXPLICIT]; |
|
452 | 452 | |
453 | 453 | public function __construct($id, $uri, $mode = 1) |
454 | 454 | { |
@@ -664,8 +664,8 @@ discard block |
||
664 | 664 | class FluidContext implements FluidInterface, \ArrayAccess, \Iterator |
665 | 665 | { |
666 | 666 | use NewableTrait, |
667 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
668 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
667 | + ReservedCallTrait, // For compatibility with PHP 5.6. |
|
668 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
669 | 669 | |
670 | 670 | private $document; |
671 | 671 | private $nodes = []; |
@@ -675,14 +675,14 @@ discard block |
||
675 | 675 | { |
676 | 676 | $this->document = $document; |
677 | 677 | |
678 | - if (! \is_array($context) && ! $context instanceof \Traversable) { |
|
678 | + if (!\is_array($context) && !$context instanceof \Traversable) { |
|
679 | 679 | // DOMDocument, DOMElement and DOMNode are not iterable. |
680 | 680 | // DOMNodeList and FluidContext are iterable. |
681 | - $context = [ $context ]; |
|
681 | + $context = [$context]; |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | foreach ($context as $n) { |
685 | - if (! $n instanceof \DOMNode) { |
|
685 | + if (!$n instanceof \DOMNode) { |
|
686 | 686 | throw new \Exception('Node type not recognized.'); |
687 | 687 | } |
688 | 688 | |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | } |
809 | 809 | } |
810 | 810 | |
811 | - if (! $found) { |
|
811 | + if (!$found) { |
|
812 | 812 | $unique_results[] = $r; |
813 | 813 | } |
814 | 814 | } |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | // the user has passed two arguments: |
922 | 922 | // 1. is the attribute name |
923 | 923 | // 2. is the attribute value |
924 | - if (! \is_array($arguments[0])) { |
|
924 | + if (!\is_array($arguments[0])) { |
|
925 | 925 | $attrs = [$arguments[0] => $arguments[1]]; |
926 | 926 | } |
927 | 927 | |
@@ -1045,8 +1045,8 @@ discard block |
||
1045 | 1045 | |
1046 | 1046 | protected function handleOptionals($element, &$optionals) |
1047 | 1047 | { |
1048 | - if (! \is_array($element)) { |
|
1049 | - $element = [ $element ]; |
|
1048 | + if (!\is_array($element)) { |
|
1049 | + $element = [$element]; |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | $switch_context = false; |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | } |
1070 | 1070 | } |
1071 | 1071 | |
1072 | - return [ $element, $attributes, $switch_context ]; |
|
1072 | + return [$element, $attributes, $switch_context]; |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | protected function insertElement($element, &$optionals, $fn) |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | // offers to the user and is the same of: |
1094 | 1094 | // 1. appending a child switching the context |
1095 | 1095 | // 2. setting the attributes over the new context. |
1096 | - if (! empty($attributes)) { |
|
1096 | + if (!empty($attributes)) { |
|
1097 | 1097 | $new_context->setAttribute($attributes); |
1098 | 1098 | } |
1099 | 1099 | |
@@ -1121,9 +1121,9 @@ discard block |
||
1121 | 1121 | $v_is_string = \is_string($v); |
1122 | 1122 | $v_is_xml = $v_is_string && is_an_xml_string($v); |
1123 | 1123 | $k_is_special = $k_is_string && $k[0] === '@'; |
1124 | - $k_isnt_special = ! $k_is_special; |
|
1125 | - $v_isnt_string = ! $v_is_string; |
|
1126 | - $v_isnt_xml = ! $v_is_xml; |
|
1124 | + $k_isnt_special = !$k_is_special; |
|
1125 | + $v_isnt_string = !$v_is_string; |
|
1126 | + $v_isnt_xml = !$v_is_xml; |
|
1127 | 1127 | /////////////////////////////////////////////////////// |
1128 | 1128 | |
1129 | 1129 | if ($k_is_string && $k_isnt_special && $v_is_string && $v_isnt_xml) { |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | ///////////////////////////////////////////////////// |
1146 | - $k_is_special_a = $k_is_special && ! $k_is_special_c; |
|
1146 | + $k_is_special_a = $k_is_special && !$k_is_special_c; |
|
1147 | 1147 | ///////////////////////////////////////////////////// |
1148 | 1148 | |
1149 | 1149 | if ($k_is_special_a && $v_is_string) { |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | $v_is_domnode = $v instanceof \DOMNode; |
1196 | 1196 | /////////////////////////////////////// |
1197 | 1197 | |
1198 | - if ($k_is_integer && ! $v_is_domdoc && $v_is_domnode) { |
|
1198 | + if ($k_is_integer && !$v_is_domdoc && $v_is_domnode) { |
|
1199 | 1199 | return $this->insertIntegerDomnode($parent, $k, $v, $fn, $optionals); |
1200 | 1200 | } |
1201 | 1201 | |
@@ -1263,15 +1263,15 @@ discard block |
||
1263 | 1263 | |
1264 | 1264 | protected function attachNodes($parent, $nodes, $fn) |
1265 | 1265 | { |
1266 | - if (! \is_array($nodes) && ! $nodes instanceof \Traversable) { |
|
1267 | - $nodes = [ $nodes ]; |
|
1266 | + if (!\is_array($nodes) && !$nodes instanceof \Traversable) { |
|
1267 | + $nodes = [$nodes]; |
|
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | $context = []; |
1271 | 1271 | |
1272 | 1272 | foreach ($nodes as $el) { |
1273 | 1273 | $el = $this->document->dom->importNode($el, true); |
1274 | - $context[] = $fn( $parent, $el); |
|
1274 | + $context[] = $fn($parent, $el); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | return $context; |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | $el = $this->createElement($k, $v); |
1314 | 1314 | $el = $fn($parent, $el); |
1315 | 1315 | |
1316 | - return [ $el ]; |
|
1316 | + return [$el]; |
|
1317 | 1317 | } |
1318 | 1318 | |
1319 | 1319 | protected function insertStringMixed($parent, $k, $v, $fn, &$optionals) |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | // they are supplied, so 'appendChild' is the perfect operation. |
1330 | 1330 | $this->newContext($el)->appendChild($v, ...$optionals); |
1331 | 1331 | |
1332 | - return [ $el ]; |
|
1332 | + return [$el]; |
|
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals) |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | $el = $this->createElement($v); |
1357 | 1357 | $el = $fn($parent, $el); |
1358 | 1358 | |
1359 | - return [ $el ]; |
|
1359 | + return [$el]; |
|
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | protected function insertIntegerXml($parent, $k, $v, $fn) |