@@ -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,7 +147,7 @@ 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 | // Removes any empty new line at the beginning, |
| 152 | 152 | // otherwise the first character check fails. |
| 153 | 153 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $document = \file_get_contents($file); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if (! $is_file || ! $is_readable || ! $document) { |
|
| 162 | + if (!$is_file || !$is_readable || !$document) { |
|
| 163 | 163 | throw new \Exception("File '$file' not accessible."); |
| 164 | 164 | } |
| 165 | 165 | } |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | public function __construct($root = null, $options = []) |
| 171 | 171 | { |
| 172 | - $defaults = [ 'root' => self::ROOT_NODE, |
|
| 172 | + $defaults = ['root' => self::ROOT_NODE, |
|
| 173 | 173 | 'version' => '1.0', |
| 174 | 174 | 'encoding' => 'UTF-8', |
| 175 | - 'stylesheet' => null ]; |
|
| 175 | + 'stylesheet' => null]; |
|
| 176 | 176 | |
| 177 | 177 | if (\is_string($root)) { |
| 178 | 178 | // The root option can be specified as first argument |
@@ -197,11 +197,11 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | $this->handler = new FluidInsertionHandler($doc); |
| 199 | 199 | |
| 200 | - if (! empty($opts['root'])) { |
|
| 200 | + if (!empty($opts['root'])) { |
|
| 201 | 201 | $this->appendSibling($opts['root']); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if (! empty($opts['stylesheet'])) { |
|
| 204 | + if (!empty($opts['stylesheet'])) { |
|
| 205 | 205 | $attrs = 'type="text/xsl" ' |
| 206 | 206 | . "encoding=\"{$opts['encoding']}\" " |
| 207 | 207 | . 'indent="yes" ' |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $namespaces = []; |
| 240 | 240 | |
| 241 | 241 | if (\is_string($arguments[0])) { |
| 242 | - $args = [ $arguments[0], $arguments[1] ]; |
|
| 242 | + $args = [$arguments[0], $arguments[1]]; |
|
| 243 | 243 | |
| 244 | 244 | if (isset($arguments[2])) { |
| 245 | 245 | $args[] = $arguments[2]; |
@@ -446,16 +446,16 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | class FluidNamespace |
| 448 | 448 | { |
| 449 | - const ID = 'id' ; |
|
| 450 | - const URI = 'uri' ; |
|
| 449 | + const ID = 'id'; |
|
| 450 | + const URI = 'uri'; |
|
| 451 | 451 | const MODE = 'mode'; |
| 452 | 452 | |
| 453 | 453 | const MODE_IMPLICIT = 0; |
| 454 | 454 | const MODE_EXPLICIT = 1; |
| 455 | 455 | |
| 456 | - private $config = [ self::ID => '', |
|
| 456 | + private $config = [self::ID => '', |
|
| 457 | 457 | self::URI => '', |
| 458 | - self::MODE => self::MODE_EXPLICIT ]; |
|
| 458 | + self::MODE => self::MODE_EXPLICIT]; |
|
| 459 | 459 | |
| 460 | 460 | public function __construct($id, $uri, $mode = 1) |
| 461 | 461 | { |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | { |
| 494 | 494 | $id = $this->id(); |
| 495 | 495 | |
| 496 | - if (! empty($id)) { |
|
| 496 | + if (!empty($id)) { |
|
| 497 | 497 | $id .= ':'; |
| 498 | 498 | } |
| 499 | 499 | |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | { |
| 682 | 682 | $this->document = $document; |
| 683 | 683 | $this->dom = $document->dom; |
| 684 | - $this->namespaces =& $document->namespaces; |
|
| 684 | + $this->namespaces = & $document->namespaces; |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | public function insertElement(&$nodes, $element, &$optionals, $fn, $orig_context) |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | // offers to the user and is the same of: |
| 705 | 705 | // 1. appending a child switching the context |
| 706 | 706 | // 2. setting the attributes over the new context. |
| 707 | - if (! empty($attributes)) { |
|
| 707 | + if (!empty($attributes)) { |
|
| 708 | 708 | $new_context->setAttribute($attributes); |
| 709 | 709 | } |
| 710 | 710 | |
@@ -722,8 +722,8 @@ discard block |
||
| 722 | 722 | |
| 723 | 723 | protected function handleOptionals($element, &$optionals) |
| 724 | 724 | { |
| 725 | - if (! \is_array($element)) { |
|
| 726 | - $element = [ $element ]; |
|
| 725 | + if (!\is_array($element)) { |
|
| 726 | + $element = [$element]; |
|
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | $switch_context = false; |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | } |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | - return [ $element, $attributes, $switch_context ]; |
|
| 749 | + return [$element, $attributes, $switch_context]; |
|
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | |
@@ -767,9 +767,9 @@ discard block |
||
| 767 | 767 | $v_is_string = \is_string($v); |
| 768 | 768 | $v_is_xml = $v_is_string && is_an_xml_string($v); |
| 769 | 769 | $k_is_special = $k_is_string && $k[0] === '@'; |
| 770 | - $k_isnt_special = ! $k_is_special; |
|
| 771 | - $v_isnt_string = ! $v_is_string; |
|
| 772 | - $v_isnt_xml = ! $v_is_xml; |
|
| 770 | + $k_isnt_special = !$k_is_special; |
|
| 771 | + $v_isnt_string = !$v_is_string; |
|
| 772 | + $v_isnt_xml = !$v_is_xml; |
|
| 773 | 773 | /////////////////////////////////////////////////////// |
| 774 | 774 | |
| 775 | 775 | if ($k_is_string && $k_isnt_special && $v_is_string && $v_isnt_xml) { |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | } |
| 790 | 790 | |
| 791 | 791 | ///////////////////////////////////////////////////// |
| 792 | - $k_is_special_a = $k_is_special && ! $k_is_special_c; |
|
| 792 | + $k_is_special_a = $k_is_special && !$k_is_special_c; |
|
| 793 | 793 | ///////////////////////////////////////////////////// |
| 794 | 794 | |
| 795 | 795 | if ($k_is_special_a && $v_is_string) { |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | $v_is_domnode = $v instanceof \DOMNode; |
| 842 | 842 | /////////////////////////////////////// |
| 843 | 843 | |
| 844 | - if ($k_is_integer && ! $v_is_domdoc && $v_is_domnode) { |
|
| 844 | + if ($k_is_integer && !$v_is_domdoc && $v_is_domnode) { |
|
| 845 | 845 | return $this->insertIntegerDomnode($parent, $k, $v, $fn, $optionals); |
| 846 | 846 | } |
| 847 | 847 | |
@@ -909,8 +909,8 @@ discard block |
||
| 909 | 909 | |
| 910 | 910 | protected function attachNodes($parent, $nodes, $fn) |
| 911 | 911 | { |
| 912 | - if (! \is_array($nodes) && ! $nodes instanceof \Traversable) { |
|
| 913 | - $nodes = [ $nodes ]; |
|
| 912 | + if (!\is_array($nodes) && !$nodes instanceof \Traversable) { |
|
| 913 | + $nodes = [$nodes]; |
|
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | $context = []; |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | $el = $this->createElement($k, $v); |
| 960 | 960 | $el = $fn($parent, $el); |
| 961 | 961 | |
| 962 | - return [ $el ]; |
|
| 962 | + return [$el]; |
|
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | protected function insertStringMixed($parent, $k, $v, $fn, &$optionals) |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | // they are supplied, so 'appendChild' is the perfect operation. |
| 976 | 976 | $this->newContext($el)->appendChild($v, ...$optionals); |
| 977 | 977 | |
| 978 | - return [ $el ]; |
|
| 978 | + return [$el]; |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals) |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | $el = $this->createElement($v); |
| 1003 | 1003 | $el = $fn($parent, $el); |
| 1004 | 1004 | |
| 1005 | - return [ $el ]; |
|
| 1005 | + return [$el]; |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | protected function insertIntegerXml($parent, $k, $v, $fn) |
@@ -1074,8 +1074,8 @@ discard block |
||
| 1074 | 1074 | class FluidContext implements FluidInterface, \ArrayAccess, \Iterator |
| 1075 | 1075 | { |
| 1076 | 1076 | use NewableTrait, |
| 1077 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
| 1078 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
| 1077 | + ReservedCallTrait, // For compatibility with PHP 5.6. |
|
| 1078 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
| 1079 | 1079 | |
| 1080 | 1080 | private $document; |
| 1081 | 1081 | private $handler; |
@@ -1087,14 +1087,14 @@ discard block |
||
| 1087 | 1087 | $this->document = $document; |
| 1088 | 1088 | $this->handler = $handler; |
| 1089 | 1089 | |
| 1090 | - if (! \is_array($context) && ! $context instanceof \Traversable) { |
|
| 1090 | + if (!\is_array($context) && !$context instanceof \Traversable) { |
|
| 1091 | 1091 | // DOMDocument, DOMElement and DOMNode are not iterable. |
| 1092 | 1092 | // DOMNodeList and FluidContext are iterable. |
| 1093 | - $context = [ $context ]; |
|
| 1093 | + $context = [$context]; |
|
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | 1096 | foreach ($context as $n) { |
| 1097 | - if (! $n instanceof \DOMNode) { |
|
| 1097 | + if (!$n instanceof \DOMNode) { |
|
| 1098 | 1098 | throw new \Exception('Node type not recognized.'); |
| 1099 | 1099 | } |
| 1100 | 1100 | |
@@ -1328,7 +1328,7 @@ discard block |
||
| 1328 | 1328 | // the user has passed two arguments: |
| 1329 | 1329 | // 1. is the attribute name |
| 1330 | 1330 | // 2. is the attribute value |
| 1331 | - if (! \is_array($arguments[0])) { |
|
| 1331 | + if (!\is_array($arguments[0])) { |
|
| 1332 | 1332 | $attrs = [$arguments[0] => $arguments[1]]; |
| 1333 | 1333 | } |
| 1334 | 1334 | |
@@ -1463,7 +1463,7 @@ discard block |
||
| 1463 | 1463 | } |
| 1464 | 1464 | } |
| 1465 | 1465 | |
| 1466 | - if (! $found) { |
|
| 1466 | + if (!$found) { |
|
| 1467 | 1467 | $set[] = $r; |
| 1468 | 1468 | } |
| 1469 | 1469 | } |