@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | function is_an_xml_string($string) |
| 82 | 82 | { |
| 83 | - if (! \is_string($string)) { |
|
| 83 | + if (!\is_string($string)) { |
|
| 84 | 84 | return false; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $namespaces = []; |
| 245 | 245 | |
| 246 | 246 | if (\is_string($arguments[0])) { |
| 247 | - $args = [ $arguments[0], $arguments[1] ]; |
|
| 247 | + $args = [$arguments[0], $arguments[1]]; |
|
| 248 | 248 | |
| 249 | 249 | if (isset($arguments[2])) { |
| 250 | 250 | $args[] = $arguments[2]; |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | { |
| 270 | 270 | use FluidNamespaceTrait, |
| 271 | 271 | NewableTrait, |
| 272 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
| 273 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
| 272 | + ReservedCallTrait, // For compatibility with PHP 5.6. |
|
| 273 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
| 274 | 274 | |
| 275 | 275 | const ROOT_NODE = 'doc'; |
| 276 | 276 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | public static function load($document) |
| 280 | 280 | { |
| 281 | - if (\is_string($document) && ! is_an_xml_string($document)) { |
|
| 281 | + if (\is_string($document) && !is_an_xml_string($document)) { |
|
| 282 | 282 | // Removes any empty new line at the beginning, |
| 283 | 283 | // otherwise the first character check fails. |
| 284 | 284 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $document = \file_get_contents($file); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if (! $is_file || ! $is_readable || ! $document) { |
|
| 293 | + if (!$is_file || !$is_readable || !$document) { |
|
| 294 | 294 | throw new \Exception("File '$file' not accessible."); |
| 295 | 295 | } |
| 296 | 296 | } |
@@ -300,10 +300,10 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | public function __construct($root = null, $options = []) |
| 302 | 302 | { |
| 303 | - $defaults = [ 'root' => self::ROOT_NODE, |
|
| 303 | + $defaults = ['root' => self::ROOT_NODE, |
|
| 304 | 304 | 'version' => '1.0', |
| 305 | 305 | 'encoding' => 'UTF-8', |
| 306 | - 'stylesheet' => null ]; |
|
| 306 | + 'stylesheet' => null]; |
|
| 307 | 307 | |
| 308 | 308 | if (\is_string($root)) { |
| 309 | 309 | // The root option can be specified as first argument |
@@ -497,14 +497,14 @@ discard block |
||
| 497 | 497 | |
| 498 | 498 | protected function newContext($context = null) |
| 499 | 499 | { |
| 500 | - if (! $context) { |
|
| 500 | + if (!$context) { |
|
| 501 | 501 | $context = $this->dom->documentElement; |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | // If the user has requested ['root' => null] at construction time |
| 505 | 505 | // the 'documentElement' property is null because we have not created |
| 506 | 506 | // a root node yet. |
| 507 | - if (! $context) { |
|
| 507 | + if (!$context) { |
|
| 508 | 508 | // Whether there is not a root node, the DOMDocument is |
| 509 | 509 | // promoted as root node. |
| 510 | 510 | $context = $this->dom; |
@@ -529,8 +529,8 @@ discard block |
||
| 529 | 529 | { |
| 530 | 530 | use FluidNamespaceTrait, |
| 531 | 531 | NewableTrait, |
| 532 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
| 533 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
| 532 | + ReservedCallTrait, // For compatibility with PHP 5.6. |
|
| 533 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
| 534 | 534 | |
| 535 | 535 | private $dom; |
| 536 | 536 | private $nodes = []; |
@@ -538,8 +538,8 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | public function __construct($context, array $namespaces = []) |
| 540 | 540 | { |
| 541 | - if (! \is_array($context)) { |
|
| 542 | - $context = [ $context ]; |
|
| 541 | + if (!\is_array($context)) { |
|
| 542 | + $context = [$context]; |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | foreach ($context as $n) { |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | } |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | - if (! empty($namespaces)) { |
|
| 563 | + if (!empty($namespaces)) { |
|
| 564 | 564 | $this->namespace(...\array_values($namespaces)); |
| 565 | 565 | } |
| 566 | 566 | } |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | } |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | - if (! $found) { |
|
| 692 | + if (!$found) { |
|
| 693 | 693 | $unique_results[] = $r; |
| 694 | 694 | } |
| 695 | 695 | } |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | // appendChild($child, $value?, $attributes? = [], $switchContext? = false) |
| 745 | 745 | public function appendChild($child, ...$optionals) |
| 746 | 746 | { |
| 747 | - return $this->insertElement($child, $optionals, [ static::class, 'doAppendChild' ]); |
|
| 747 | + return $this->insertElement($child, $optionals, [static::class, 'doAppendChild']); |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | // Alias of appendChild(). |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | |
| 761 | 761 | public function prependSibling($sibling, ...$optionals) |
| 762 | 762 | { |
| 763 | - return $this->insertElement($sibling, $optionals, [ static::class, 'doPrependSibling' ]); |
|
| 763 | + return $this->insertElement($sibling, $optionals, [static::class, 'doPrependSibling']); |
|
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | // Alias of prependSibling(). |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | |
| 784 | 784 | public function appendSibling($sibling, ...$optionals) |
| 785 | 785 | { |
| 786 | - return $this->insertElement($sibling, $optionals, [ static::class, 'doAppendSibling' ]); |
|
| 786 | + return $this->insertElement($sibling, $optionals, [static::class, 'doAppendSibling']); |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | // Alias of appendSibling(). |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | // the user has passed two arguments: |
| 812 | 812 | // 1. is the attribute name |
| 813 | 813 | // 2. is the attribute value |
| 814 | - if (! \is_array($arguments[0])) { |
|
| 814 | + if (!\is_array($arguments[0])) { |
|
| 815 | 815 | $attrs = [$arguments[0] => $arguments[1]]; |
| 816 | 816 | } |
| 817 | 817 | |
@@ -935,8 +935,8 @@ discard block |
||
| 935 | 935 | |
| 936 | 936 | protected function insertElement($element, array $optionals, callable $fn) |
| 937 | 937 | { |
| 938 | - if (! \is_array($element)) { |
|
| 939 | - $element = [ $element ]; |
|
| 938 | + if (!\is_array($element)) { |
|
| 939 | + $element = [$element]; |
|
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | $switch_context = false; |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | // offers to the user and is the same of: |
| 977 | 977 | // 1. appending a child switching the context |
| 978 | 978 | // 2. setting the attributes over the new context. |
| 979 | - if (! empty($attributes)) { |
|
| 979 | + if (!empty($attributes)) { |
|
| 980 | 980 | $context->setAttribute($attributes); |
| 981 | 981 | } |
| 982 | 982 | |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | |
| 990 | 990 | protected function handleInsertion(...$arguments) |
| 991 | 991 | { |
| 992 | - $check_sequence = [ 'specialContentHandler', |
|
| 992 | + $check_sequence = ['specialContentHandler', |
|
| 993 | 993 | 'specialAttributeHandler', |
| 994 | 994 | 'stringStringHandler', |
| 995 | 995 | 'stringMixedHandler', |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | 'integerDomnodeHandler', |
| 1002 | 1002 | 'integerSimplexmlHandler', |
| 1003 | 1003 | 'integerFluidxmlHandler', |
| 1004 | - 'integerFluidcontextHandler' ]; |
|
| 1004 | + 'integerFluidcontextHandler']; |
|
| 1005 | 1005 | |
| 1006 | 1006 | foreach ($check_sequence as $check) { |
| 1007 | 1007 | $ret = $this->$check(...$arguments); |
@@ -1048,8 +1048,8 @@ discard block |
||
| 1048 | 1048 | |
| 1049 | 1049 | protected function attachNodes($parent, $nodes, $fn) |
| 1050 | 1050 | { |
| 1051 | - if (! \is_array($nodes) && ! $nodes instanceof \Traversable) { |
|
| 1052 | - $nodes = [ $nodes ]; |
|
| 1051 | + if (!\is_array($nodes) && !$nodes instanceof \Traversable) { |
|
| 1052 | + $nodes = [$nodes]; |
|
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | $context = []; |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | |
| 1065 | 1065 | protected function specialContentHandler($parent, $k, $v, $optionals, $fn) |
| 1066 | 1066 | { |
| 1067 | - if (! \is_string($k) || $k !== '@'|| ! \is_string($v)) { |
|
| 1067 | + if (!\is_string($k) || $k !== '@' || !\is_string($v)) { |
|
| 1068 | 1068 | return false; |
| 1069 | 1069 | } |
| 1070 | 1070 | |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | |
| 1086 | 1086 | protected function specialAttributeHandler($parent, $k, $v, $optionals, $fn) |
| 1087 | 1087 | { |
| 1088 | - if (! \is_string($k) || $k[0] !== '@' || ! \is_string($v)) { |
|
| 1088 | + if (!\is_string($k) || $k[0] !== '@' || !\is_string($v)) { |
|
| 1089 | 1089 | return false; |
| 1090 | 1090 | } |
| 1091 | 1091 | |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | |
| 1101 | 1101 | protected function stringStringHandler($parent, $k, $v, $optionals, $fn) |
| 1102 | 1102 | { |
| 1103 | - if (! \is_string($k) || ! \is_string($v)) { |
|
| 1103 | + if (!\is_string($k) || !\is_string($v)) { |
|
| 1104 | 1104 | return false; |
| 1105 | 1105 | } |
| 1106 | 1106 | |
@@ -1110,12 +1110,12 @@ discard block |
||
| 1110 | 1110 | $el = $this->createElement($k, $v); |
| 1111 | 1111 | $el = \call_user_func($fn, $parent, $el); |
| 1112 | 1112 | |
| 1113 | - return [ $el ]; |
|
| 1113 | + return [$el]; |
|
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | 1116 | protected function stringMixedHandler($parent, $k, $v, $optionals, $fn) |
| 1117 | 1117 | { |
| 1118 | - if (! \is_string($k) || \is_string($v)) { |
|
| 1118 | + if (!\is_string($k) || \is_string($v)) { |
|
| 1119 | 1119 | return false; |
| 1120 | 1120 | } |
| 1121 | 1121 | |
@@ -1130,12 +1130,12 @@ discard block |
||
| 1130 | 1130 | // they are supplied, so 'appendChild' is the perfect operation. |
| 1131 | 1131 | $this->newContext($el)->appendChild($v, ...$optionals); |
| 1132 | 1132 | |
| 1133 | - return [ $el ]; |
|
| 1133 | + return [$el]; |
|
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | 1136 | protected function integerArrayHandler($parent, $k, $v, $optionals, $fn) |
| 1137 | 1137 | { |
| 1138 | - if (! \is_int($k) || ! \is_array($v)) { |
|
| 1138 | + if (!\is_int($k) || !\is_array($v)) { |
|
| 1139 | 1139 | return false; |
| 1140 | 1140 | } |
| 1141 | 1141 | |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | |
| 1156 | 1156 | protected function integerStringNotXmlHandler($parent, $k, $v, $optionals, $fn) |
| 1157 | 1157 | { |
| 1158 | - if (! \is_int($k) || ! \is_string($v) || is_an_xml_string($v)) { |
|
| 1158 | + if (!\is_int($k) || !\is_string($v) || is_an_xml_string($v)) { |
|
| 1159 | 1159 | return false; |
| 1160 | 1160 | } |
| 1161 | 1161 | |
@@ -1165,12 +1165,12 @@ discard block |
||
| 1165 | 1165 | $el = $this->createElement($v); |
| 1166 | 1166 | $el = \call_user_func($fn, $parent, $el); |
| 1167 | 1167 | |
| 1168 | - return [ $el ]; |
|
| 1168 | + return [$el]; |
|
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | protected function integerXmlHandler($parent, $k, $v, $optionals, $fn) |
| 1172 | 1172 | { |
| 1173 | - if (! \is_int($k) || ! is_an_xml_string($v)) { |
|
| 1173 | + if (!\is_int($k) || !is_an_xml_string($v)) { |
|
| 1174 | 1174 | return false; |
| 1175 | 1175 | } |
| 1176 | 1176 | |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | |
| 1205 | 1205 | protected function integerDomdocumentHandler($parent, $k, $v, $optionals, $fn) |
| 1206 | 1206 | { |
| 1207 | - if (! \is_int($k) || ! $v instanceof \DOMDocument) { |
|
| 1207 | + if (!\is_int($k) || !$v instanceof \DOMDocument) { |
|
| 1208 | 1208 | return false; |
| 1209 | 1209 | } |
| 1210 | 1210 | |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | |
| 1220 | 1220 | protected function integerDomnodelistHandler($parent, $k, $v, $optionals, $fn) |
| 1221 | 1221 | { |
| 1222 | - if (! \is_int($k) || ! $v instanceof \DOMNodeList) { |
|
| 1222 | + if (!\is_int($k) || !$v instanceof \DOMNodeList) { |
|
| 1223 | 1223 | return false; |
| 1224 | 1224 | } |
| 1225 | 1225 | |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | |
| 1229 | 1229 | protected function integerDomnodeHandler($parent, $k, $v, $optionals, $fn) |
| 1230 | 1230 | { |
| 1231 | - if (! \is_int($k) || ! $v instanceof \DOMNode) { |
|
| 1231 | + if (!\is_int($k) || !$v instanceof \DOMNode) { |
|
| 1232 | 1232 | return false; |
| 1233 | 1233 | } |
| 1234 | 1234 | |
@@ -1237,7 +1237,7 @@ discard block |
||
| 1237 | 1237 | |
| 1238 | 1238 | protected function integerSimplexmlHandler($parent, $k, $v, $optionals, $fn) |
| 1239 | 1239 | { |
| 1240 | - if (! \is_int($k) || ! $v instanceof \SimpleXMLElement) { |
|
| 1240 | + if (!\is_int($k) || !$v instanceof \SimpleXMLElement) { |
|
| 1241 | 1241 | return false; |
| 1242 | 1242 | } |
| 1243 | 1243 | |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | |
| 1247 | 1247 | protected function integerFluidxmlHandler($parent, $k, $v, $optionals, $fn) |
| 1248 | 1248 | { |
| 1249 | - if (! \is_int($k) || ! $v instanceof FluidXml) { |
|
| 1249 | + if (!\is_int($k) || !$v instanceof FluidXml) { |
|
| 1250 | 1250 | return false; |
| 1251 | 1251 | } |
| 1252 | 1252 | |
@@ -1255,7 +1255,7 @@ discard block |
||
| 1255 | 1255 | |
| 1256 | 1256 | protected function integerFluidcontextHandler($parent, $k, $v, $optionals, $fn) |
| 1257 | 1257 | { |
| 1258 | - if (! \is_int($k) || ! $v instanceof FluidContext) { |
|
| 1258 | + if (!\is_int($k) || !$v instanceof FluidContext) { |
|
| 1259 | 1259 | return false; |
| 1260 | 1260 | } |
| 1261 | 1261 | |
@@ -1265,16 +1265,16 @@ discard block |
||
| 1265 | 1265 | |
| 1266 | 1266 | class FluidNamespace |
| 1267 | 1267 | { |
| 1268 | - const ID = 'id' ; |
|
| 1269 | - const URI = 'uri' ; |
|
| 1268 | + const ID = 'id'; |
|
| 1269 | + const URI = 'uri'; |
|
| 1270 | 1270 | const MODE = 'mode'; |
| 1271 | 1271 | |
| 1272 | 1272 | const MODE_IMPLICIT = 0; |
| 1273 | 1273 | const MODE_EXPLICIT = 1; |
| 1274 | 1274 | |
| 1275 | - private $config = [ self::ID => '', |
|
| 1275 | + private $config = [self::ID => '', |
|
| 1276 | 1276 | self::URI => '', |
| 1277 | - self::MODE => self::MODE_EXPLICIT ]; |
|
| 1277 | + self::MODE => self::MODE_EXPLICIT]; |
|
| 1278 | 1278 | |
| 1279 | 1279 | public function __construct($id, $uri, $mode = 1) |
| 1280 | 1280 | { |