| @@ -71,7 +71,7 @@ discard block | ||
| 71 | 71 | * | 
| 72 | 72 | * @param array $arguments Options that influence the construction of the XML document. | 
| 73 | 73 | * | 
| 74 | - * @return FluidXml A new FluidXml instance. | |
| 74 | + * @return FluidContext A new FluidXml instance. | |
| 75 | 75 | */ | 
| 76 | 76 | function fluidify(...$arguments) | 
| 77 | 77 |  { | 
| @@ -88,6 +88,9 @@ discard block | ||
| 88 | 88 | return new FluidNamespace(...$arguments); | 
| 89 | 89 | } | 
| 90 | 90 | |
| 91 | +/** | |
| 92 | + * @param string $string | |
| 93 | + */ | |
| 91 | 94 | function is_an_xml_string($string) | 
| 92 | 95 |  { | 
| 93 | 96 | // Removes any empty new line at the beginning, | 
| @@ -534,7 +537,7 @@ discard block | ||
| 534 | 537 |           * $xml->query("/doc")->query("book[@id='123']"); | 
| 535 | 538 | * ``` | 
| 536 | 539 | * | 
| 537 | - * @param string $xpath The XPath to execute. | |
| 540 | + * @param string[] $xpath The XPath to execute. | |
| 538 | 541 | * | 
| 539 | 542 | * @return FluidContext The context associated to the DOMNodeList. | 
| 540 | 543 | */ | 
| @@ -573,8 +576,16 @@ discard block | ||
| 573 | 576 | public function appendCdata($text); | 
| 574 | 577 | public function remove(...$xpath); | 
| 575 | 578 | public function xml($strip = false); | 
| 579 | + | |
| 580 | + /** | |
| 581 | + * @return SaveableTrait | |
| 582 | + */ | |
| 576 | 583 | public function save($file, $strip = false); | 
| 577 | 584 | // Aliases: | 
| 585 | + | |
| 586 | + /** | |
| 587 | + * @return FluidContext | |
| 588 | + */ | |
| 578 | 589 | public function add($child, ...$optionals); | 
| 579 | 590 | public function prepend($sibling, ...$optionals); | 
| 580 | 591 | public function insertSiblingBefore($sibling, ...$optionals); | 
| @@ -651,6 +662,9 @@ discard block | ||
| 651 | 662 | private $context; | 
| 652 | 663 | private $times; | 
| 653 | 664 | |
| 665 | + /** | |
| 666 | + * @param FluidContext $context | |
| 667 | + */ | |
| 654 | 668 | public function __construct($document, $handler, $context, $times) | 
| 655 | 669 |          { | 
| 656 | 670 | $this->document = $document; | 
| @@ -683,6 +697,9 @@ discard block | ||
| 683 | 697 | private $dom; | 
| 684 | 698 | private $namespaces; | 
| 685 | 699 | |
| 700 | + /** | |
| 701 | + * @param FluidDocument $document | |
| 702 | + */ | |
| 686 | 703 | public function __construct($document) | 
| 687 | 704 |          { | 
| 688 | 705 | $this->document = $document; | 
| @@ -924,6 +941,10 @@ discard block | ||
| 924 | 941 | return $context; | 
| 925 | 942 | } | 
| 926 | 943 | |
| 944 | + /** | |
| 945 | + * @param string $k | |
| 946 | + * @param string $v | |
| 947 | + */ | |
| 927 | 948 | protected function insertSpecialContent($parent, $k, $v) | 
| 928 | 949 |          { | 
| 929 | 950 | // The user has passed an element text content: | 
| @@ -941,6 +962,10 @@ discard block | ||
| 941 | 962 | return []; | 
| 942 | 963 | } | 
| 943 | 964 | |
| 965 | + /** | |
| 966 | + * @param string $k | |
| 967 | + * @param string $v | |
| 968 | + */ | |
| 944 | 969 | protected function insertSpecialAttribute($parent, $k, $v) | 
| 945 | 970 |          { | 
| 946 | 971 | // The user has passed an attribute name and an attribute value: | 
| @@ -952,6 +977,10 @@ discard block | ||
| 952 | 977 | return []; | 
| 953 | 978 | } | 
| 954 | 979 | |
| 980 | + /** | |
| 981 | + * @param string $k | |
| 982 | + * @param string $v | |
| 983 | + */ | |
| 955 | 984 | protected function insertStringString($parent, $k, $v, $fn) | 
| 956 | 985 |          { | 
| 957 | 986 | // The user has passed an element name and an element value: | 
| @@ -963,6 +992,9 @@ discard block | ||
| 963 | 992 | return [ $el ]; | 
| 964 | 993 | } | 
| 965 | 994 | |
| 995 | + /** | |
| 996 | + * @param string $k | |
| 997 | + */ | |
| 966 | 998 | protected function insertStringMixed($parent, $k, $v, $fn, &$optionals) | 
| 967 | 999 |          { | 
| 968 | 1000 | // The user has passed one of these two cases: | 
| @@ -979,6 +1011,9 @@ discard block | ||
| 979 | 1011 | return [ $el ]; | 
| 980 | 1012 | } | 
| 981 | 1013 | |
| 1014 | + /** | |
| 1015 | + * @param integer $k | |
| 1016 | + */ | |
| 982 | 1017 | protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals) | 
| 983 | 1018 |          { | 
| 984 | 1019 | // The user has passed a wrapper array: | 
| @@ -995,6 +1030,10 @@ discard block | ||
| 995 | 1030 | return $context; | 
| 996 | 1031 | } | 
| 997 | 1032 | |
| 1033 | + /** | |
| 1034 | + * @param integer $k | |
| 1035 | + * @param string $v | |
| 1036 | + */ | |
| 998 | 1037 | protected function insertIntegerString($parent, $k, $v, $fn) | 
| 999 | 1038 |          { | 
| 1000 | 1039 | // The user has passed a node name without a node value: | 
| @@ -1006,6 +1045,10 @@ discard block | ||
| 1006 | 1045 | return [ $el ]; | 
| 1007 | 1046 | } | 
| 1008 | 1047 | |
| 1048 | + /** | |
| 1049 | + * @param integer $k | |
| 1050 | + * @param string $v | |
| 1051 | + */ | |
| 1009 | 1052 | protected function insertIntegerXml($parent, $k, $v, $fn) | 
| 1010 | 1053 |          { | 
| 1011 | 1054 | // The user has passed an XML document instance: | 
| @@ -1035,6 +1078,10 @@ discard block | ||
| 1035 | 1078 | return $this->attachNodes($parent, $nodes, $fn); | 
| 1036 | 1079 | } | 
| 1037 | 1080 | |
| 1081 | + /** | |
| 1082 | + * @param integer $k | |
| 1083 | + * @param \DOMDocument $v | |
| 1084 | + */ | |
| 1038 | 1085 | protected function insertIntegerDomdocument($parent, $k, $v, $fn) | 
| 1039 | 1086 |          { | 
| 1040 | 1087 | // A DOMDocument can have multiple root nodes. | 
| @@ -1046,26 +1093,46 @@ discard block | ||
| 1046 | 1093 | // return $this->attachNodes($parent, $v->documentElement, $fn); | 
| 1047 | 1094 | } | 
| 1048 | 1095 | |
| 1096 | + /** | |
| 1097 | + * @param integer $k | |
| 1098 | + * @param \DOMNodeList $v | |
| 1099 | + */ | |
| 1049 | 1100 | protected function insertIntegerDomnodelist($parent, $k, $v, $fn) | 
| 1050 | 1101 |          { | 
| 1051 | 1102 | return $this->attachNodes($parent, $v, $fn); | 
| 1052 | 1103 | } | 
| 1053 | 1104 | |
| 1105 | + /** | |
| 1106 | + * @param integer $k | |
| 1107 | + * @param \DOMNode $v | |
| 1108 | + */ | |
| 1054 | 1109 | protected function insertIntegerDomnode($parent, $k, $v, $fn) | 
| 1055 | 1110 |          { | 
| 1056 | 1111 | return $this->attachNodes($parent, $v, $fn); | 
| 1057 | 1112 | } | 
| 1058 | 1113 | |
| 1114 | + /** | |
| 1115 | + * @param integer $k | |
| 1116 | + * @param \SimpleXMLElement $v | |
| 1117 | + */ | |
| 1059 | 1118 | protected function insertIntegerSimplexml($parent, $k, $v, $fn) | 
| 1060 | 1119 |          { | 
| 1061 | 1120 | return $this->attachNodes($parent, \dom_import_simplexml($v), $fn); | 
| 1062 | 1121 | } | 
| 1063 | 1122 | |
| 1123 | + /** | |
| 1124 | + * @param integer $k | |
| 1125 | + * @param FluidXml $v | |
| 1126 | + */ | |
| 1064 | 1127 | protected function insertIntegerFluidxml($parent, $k, $v, $fn) | 
| 1065 | 1128 |          { | 
| 1066 | 1129 | return $this->attachNodes($parent, $v->dom()->documentElement, $fn); | 
| 1067 | 1130 | } | 
| 1068 | 1131 | |
| 1132 | + /** | |
| 1133 | + * @param integer $k | |
| 1134 | + * @param FluidContext $v | |
| 1135 | + */ | |
| 1069 | 1136 | protected function insertIntegerFluidcontext($parent, $k, $v, $fn) | 
| 1070 | 1137 |          { | 
| 1071 | 1138 | return $this->attachNodes($parent, $v->asArray(), $fn); | 
| @@ -1450,6 +1517,9 @@ discard block | ||
| 1450 | 1517 | return $set; | 
| 1451 | 1518 | } | 
| 1452 | 1519 | |
| 1520 | + /** | |
| 1521 | + * @param callable $fn | |
| 1522 | + */ | |
| 1453 | 1523 | protected function callfn($fn, $args) | 
| 1454 | 1524 |          { | 
| 1455 | 1525 |                  if ($fn instanceof \Closure) { | 
| @@ -138,9 +138,9 @@ discard block | ||
| 138 | 138 | class FluidXml implements FluidInterface | 
| 139 | 139 |  { | 
| 140 | 140 | use NewableTrait, | 
| 141 | - SaveableTrait, | |
| 142 | - ReservedCallTrait, // For compatibility with PHP 5.6. | |
| 143 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. | |
| 141 | + SaveableTrait, | |
| 142 | + ReservedCallTrait, // For compatibility with PHP 5.6. | |
| 143 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. | |
| 144 | 144 | |
| 145 | 145 | const ROOT_NODE = 'doc'; | 
| 146 | 146 | |
| @@ -165,9 +165,9 @@ discard block | ||
| 165 | 165 | public function __construct($root = null, $options = []) | 
| 166 | 166 |          { | 
| 167 | 167 | $defaults = [ 'root' => self::ROOT_NODE, | 
| 168 | - 'version' => '1.0', | |
| 169 | - 'encoding' => 'UTF-8', | |
| 170 | - 'stylesheet' => null ]; | |
| 168 | + 'version' => '1.0', | |
| 169 | + 'encoding' => 'UTF-8', | |
| 170 | + 'stylesheet' => null ]; | |
| 171 | 171 | |
| 172 | 172 |                  if (\is_string($root)) { | 
| 173 | 173 | // The root option can be specified as first argument | 
| @@ -198,9 +198,9 @@ discard block | ||
| 198 | 198 | |
| 199 | 199 |                  if (! empty($opts['stylesheet'])) { | 
| 200 | 200 | $attrs = 'type="text/xsl" ' | 
| 201 | -                               . "encoding=\"{$opts['encoding']}\" " | |
| 202 | - . 'indent="yes" ' | |
| 203 | -                               . "href=\"{$opts['stylesheet']}\""; | |
| 201 | +                                . "encoding=\"{$opts['encoding']}\" " | |
| 202 | + . 'indent="yes" ' | |
| 203 | +                                . "href=\"{$opts['stylesheet']}\""; | |
| 204 | 204 |                          $stylesheet = new \DOMProcessingInstruction('xml-stylesheet', $attrs); | 
| 205 | 205 | |
| 206 | 206 | $doc->dom->insertBefore($stylesheet, $doc->dom->documentElement); | 
| @@ -445,8 +445,8 @@ discard block | ||
| 445 | 445 | const MODE_EXPLICIT = 1; | 
| 446 | 446 | |
| 447 | 447 | private $config = [ self::ID => '', | 
| 448 | - self::URI => '', | |
| 449 | - self::MODE => self::MODE_EXPLICIT ]; | |
| 448 | + self::URI => '', | |
| 449 | + self::MODE => self::MODE_EXPLICIT ]; | |
| 450 | 450 | |
| 451 | 451 | public function __construct($id, $uri, $mode = 1) | 
| 452 | 452 |          { | 
| @@ -527,7 +527,6 @@ discard block | ||
| 527 | 527 | * | 
| 528 | 528 | * ```php | 
| 529 | 529 | * $xml = fluidxml(); | 
| 530 | - | |
| 531 | 530 |           * $xml->query("/doc/book[@id='123']"); | 
| 532 | 531 | * | 
| 533 | 532 | * // Relative queries are valid. | 
| @@ -547,7 +546,6 @@ discard block | ||
| 547 | 546 | * | 
| 548 | 547 | * ```php | 
| 549 | 548 | * $xml = fluidxml(); | 
| 550 | - | |
| 551 | 549 |           * $xml->appendChild('title', 'The Theory Of Everything'); | 
| 552 | 550 | * $xml->appendChild([ 'author' => 'S. Hawking' ]); | 
| 553 | 551 | * | 
| @@ -1075,9 +1073,9 @@ discard block | ||
| 1075 | 1073 | class FluidContext implements FluidInterface, \ArrayAccess, \Iterator | 
| 1076 | 1074 |  { | 
| 1077 | 1075 | use NewableTrait, | 
| 1078 | - SaveableTrait, | |
| 1079 | - ReservedCallTrait, // For compatibility with PHP 5.6. | |
| 1080 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. | |
| 1076 | + SaveableTrait, | |
| 1077 | + ReservedCallTrait, // For compatibility with PHP 5.6. | |
| 1078 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. | |
| 1081 | 1079 | |
| 1082 | 1080 | private $document; | 
| 1083 | 1081 | private $handler; | 
| @@ -139,8 +139,8 @@ discard block | ||
| 139 | 139 |  { | 
| 140 | 140 | use NewableTrait, | 
| 141 | 141 | SaveableTrait, | 
| 142 | - ReservedCallTrait, // For compatibility with PHP 5.6. | |
| 143 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. | |
| 142 | + ReservedCallTrait, // For compatibility with PHP 5.6. | |
| 143 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. | |
| 144 | 144 | |
| 145 | 145 | const ROOT_NODE = 'doc'; | 
| 146 | 146 | |
| @@ -149,12 +149,12 @@ discard block | ||
| 149 | 149 | |
| 150 | 150 | public static function load($document) | 
| 151 | 151 |          { | 
| 152 | -                if (\is_string($document) && ! is_an_xml_string($document)) { | |
| 152 | +                if (\is_string($document) && !is_an_xml_string($document)) { | |
| 153 | 153 | $file = $document; | 
| 154 | 154 | $document = \file_get_contents($file); | 
| 155 | 155 | |
| 156 | 156 | // file_get_contents returns false if it can't read. | 
| 157 | -                        if (! $document) { | |
| 157 | +                        if (!$document) { | |
| 158 | 158 |                                  throw new \Exception("File '$file' not accessible."); | 
| 159 | 159 | } | 
| 160 | 160 | } | 
| @@ -164,10 +164,10 @@ discard block | ||
| 164 | 164 | |
| 165 | 165 | public function __construct($root = null, $options = []) | 
| 166 | 166 |          { | 
| 167 | - $defaults = [ 'root' => self::ROOT_NODE, | |
| 167 | + $defaults = ['root' => self::ROOT_NODE, | |
| 168 | 168 | 'version' => '1.0', | 
| 169 | 169 | 'encoding' => 'UTF-8', | 
| 170 | - 'stylesheet' => null ]; | |
| 170 | + 'stylesheet' => null]; | |
| 171 | 171 | |
| 172 | 172 |                  if (\is_string($root)) { | 
| 173 | 173 | // The root option can be specified as first argument | 
| @@ -192,11 +192,11 @@ discard block | ||
| 192 | 192 | |
| 193 | 193 | $this->handler = new FluidInsertionHandler($doc); | 
| 194 | 194 | |
| 195 | -                if (! empty($opts['root'])) { | |
| 195 | +                if (!empty($opts['root'])) { | |
| 196 | 196 | $this->appendSibling($opts['root']); | 
| 197 | 197 | } | 
| 198 | 198 | |
| 199 | -                if (! empty($opts['stylesheet'])) { | |
| 199 | +                if (!empty($opts['stylesheet'])) { | |
| 200 | 200 | $attrs = 'type="text/xsl" ' | 
| 201 | 201 |                                 . "encoding=\"{$opts['encoding']}\" " | 
| 202 | 202 | . 'indent="yes" ' | 
| @@ -234,7 +234,7 @@ discard block | ||
| 234 | 234 | $namespaces = []; | 
| 235 | 235 | |
| 236 | 236 |                  if (\is_string($arguments[0])) { | 
| 237 | - $args = [ $arguments[0], $arguments[1] ]; | |
| 237 | + $args = [$arguments[0], $arguments[1]]; | |
| 238 | 238 | |
| 239 | 239 |                          if (isset($arguments[2])) { | 
| 240 | 240 | $args[] = $arguments[2]; | 
| @@ -437,16 +437,16 @@ discard block | ||
| 437 | 437 | |
| 438 | 438 | class FluidNamespace | 
| 439 | 439 |  { | 
| 440 | - const ID = 'id' ; | |
| 441 | - const URI = 'uri' ; | |
| 440 | + const ID = 'id'; | |
| 441 | + const URI = 'uri'; | |
| 442 | 442 | const MODE = 'mode'; | 
| 443 | 443 | |
| 444 | 444 | const MODE_IMPLICIT = 0; | 
| 445 | 445 | const MODE_EXPLICIT = 1; | 
| 446 | 446 | |
| 447 | - private $config = [ self::ID => '', | |
| 447 | + private $config = [self::ID => '', | |
| 448 | 448 | self::URI => '', | 
| 449 | - self::MODE => self::MODE_EXPLICIT ]; | |
| 449 | + self::MODE => self::MODE_EXPLICIT]; | |
| 450 | 450 | |
| 451 | 451 | public function __construct($id, $uri, $mode = 1) | 
| 452 | 452 |          { | 
| @@ -484,7 +484,7 @@ discard block | ||
| 484 | 484 |          { | 
| 485 | 485 | $id = $this->id(); | 
| 486 | 486 | |
| 487 | -                if (! empty($id)) { | |
| 487 | +                if (!empty($id)) { | |
| 488 | 488 | $id .= ':'; | 
| 489 | 489 | } | 
| 490 | 490 | |
| @@ -495,7 +495,7 @@ discard block | ||
| 495 | 495 |                  $nodes = \explode('/', $xpath); | 
| 496 | 496 | |
| 497 | 497 |                  foreach ($nodes as $node) { | 
| 498 | -                        if (! empty($node)) { | |
| 498 | +                        if (!empty($node)) { | |
| 499 | 499 | // An XPath query can have multiple slashes. | 
| 500 | 500 | // Example: //target | 
| 501 | 501 |                                  $new_xpath .= "{$id}{$node}"; | 
| @@ -629,7 +629,7 @@ discard block | ||
| 629 | 629 |          { | 
| 630 | 630 | $status = \file_put_contents($file, $this->xml($strip)); | 
| 631 | 631 | |
| 632 | -                if (! $status) { | |
| 632 | +                if (!$status) { | |
| 633 | 633 |                          throw new \Exception("The file '$file' is not writable."); | 
| 634 | 634 | } | 
| 635 | 635 | |
| @@ -687,7 +687,7 @@ discard block | ||
| 687 | 687 |          { | 
| 688 | 688 | $this->document = $document; | 
| 689 | 689 | $this->dom = $document->dom; | 
| 690 | - $this->namespaces =& $document->namespaces; | |
| 690 | + $this->namespaces = & $document->namespaces; | |
| 691 | 691 | } | 
| 692 | 692 | |
| 693 | 693 | public function insertElement(&$nodes, $element, &$optionals, $fn, $orig_context) | 
| @@ -709,7 +709,7 @@ discard block | ||
| 709 | 709 | // offers to the user and is the same of: | 
| 710 | 710 | // 1. appending a child switching the context | 
| 711 | 711 | // 2. setting the attributes over the new context. | 
| 712 | -                if (! empty($attributes)) { | |
| 712 | +                if (!empty($attributes)) { | |
| 713 | 713 | $new_context->setAttribute($attributes); | 
| 714 | 714 | } | 
| 715 | 715 | |
| @@ -723,8 +723,8 @@ discard block | ||
| 723 | 723 | |
| 724 | 724 | protected function handleOptionals($element, &$optionals) | 
| 725 | 725 |          { | 
| 726 | -                if (! \is_array($element)) { | |
| 727 | - $element = [ $element ]; | |
| 726 | +                if (!\is_array($element)) { | |
| 727 | + $element = [$element]; | |
| 728 | 728 | } | 
| 729 | 729 | |
| 730 | 730 | $switch_context = false; | 
| @@ -747,7 +747,7 @@ discard block | ||
| 747 | 747 | } | 
| 748 | 748 | } | 
| 749 | 749 | |
| 750 | - return [ $element, $attributes, $switch_context ]; | |
| 750 | + return [$element, $attributes, $switch_context]; | |
| 751 | 751 | } | 
| 752 | 752 | |
| 753 | 753 | |
| @@ -768,9 +768,9 @@ discard block | ||
| 768 | 768 | $v_is_string = \is_string($v); | 
| 769 | 769 | $v_is_xml = $v_is_string && is_an_xml_string($v); | 
| 770 | 770 | $k_is_special = $k_is_string && $k[0] === '@'; | 
| 771 | - $k_isnt_special = ! $k_is_special; | |
| 772 | - $v_isnt_string = ! $v_is_string; | |
| 773 | - $v_isnt_xml = ! $v_is_xml; | |
| 771 | + $k_isnt_special = !$k_is_special; | |
| 772 | + $v_isnt_string = !$v_is_string; | |
| 773 | + $v_isnt_xml = !$v_is_xml; | |
| 774 | 774 | /////////////////////////////////////////////////////// | 
| 775 | 775 | |
| 776 | 776 |                  if ($k_is_string && $k_isnt_special && $v_is_string && $v_isnt_xml) { | 
| @@ -790,7 +790,7 @@ discard block | ||
| 790 | 790 | } | 
| 791 | 791 | |
| 792 | 792 | ///////////////////////////////////////////////////// | 
| 793 | - $k_is_special_a = $k_is_special && ! $k_is_special_c; | |
| 793 | + $k_is_special_a = $k_is_special && !$k_is_special_c; | |
| 794 | 794 | ///////////////////////////////////////////////////// | 
| 795 | 795 | |
| 796 | 796 |                  if ($k_is_special_a && $v_is_string) { | 
| @@ -842,7 +842,7 @@ discard block | ||
| 842 | 842 | $v_is_domnode = $v instanceof \DOMNode; | 
| 843 | 843 | /////////////////////////////////////// | 
| 844 | 844 | |
| 845 | -                if ($k_is_integer && ! $v_is_domdoc && $v_is_domnode) { | |
| 845 | +                if ($k_is_integer && !$v_is_domdoc && $v_is_domnode) { | |
| 846 | 846 | return $this->insertIntegerDomnode($parent, $k, $v, $fn, $optionals); | 
| 847 | 847 | } | 
| 848 | 848 | |
| @@ -910,8 +910,8 @@ discard block | ||
| 910 | 910 | |
| 911 | 911 | protected function attachNodes($parent, $nodes, $fn) | 
| 912 | 912 |          { | 
| 913 | -                if (! \is_array($nodes) && ! $nodes instanceof \Traversable) { | |
| 914 | - $nodes = [ $nodes ]; | |
| 913 | +                if (!\is_array($nodes) && !$nodes instanceof \Traversable) { | |
| 914 | + $nodes = [$nodes]; | |
| 915 | 915 | } | 
| 916 | 916 | |
| 917 | 917 | $context = []; | 
| @@ -960,7 +960,7 @@ discard block | ||
| 960 | 960 | $el = $this->createElement($k, $v); | 
| 961 | 961 | $el = $fn($parent, $el); | 
| 962 | 962 | |
| 963 | - return [ $el ]; | |
| 963 | + return [$el]; | |
| 964 | 964 | } | 
| 965 | 965 | |
| 966 | 966 | protected function insertStringMixed($parent, $k, $v, $fn, &$optionals) | 
| @@ -976,7 +976,7 @@ discard block | ||
| 976 | 976 | // they are supplied, so 'appendChild' is the perfect operation. | 
| 977 | 977 | $this->newContext($el)->appendChild($v, ...$optionals); | 
| 978 | 978 | |
| 979 | - return [ $el ]; | |
| 979 | + return [$el]; | |
| 980 | 980 | } | 
| 981 | 981 | |
| 982 | 982 | protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals) | 
| @@ -1003,7 +1003,7 @@ discard block | ||
| 1003 | 1003 | $el = $this->createElement($v); | 
| 1004 | 1004 | $el = $fn($parent, $el); | 
| 1005 | 1005 | |
| 1006 | - return [ $el ]; | |
| 1006 | + return [$el]; | |
| 1007 | 1007 | } | 
| 1008 | 1008 | |
| 1009 | 1009 | protected function insertIntegerXml($parent, $k, $v, $fn) | 
| @@ -1076,8 +1076,8 @@ discard block | ||
| 1076 | 1076 |  { | 
| 1077 | 1077 | use NewableTrait, | 
| 1078 | 1078 | SaveableTrait, | 
| 1079 | - ReservedCallTrait, // For compatibility with PHP 5.6. | |
| 1080 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. | |
| 1079 | + ReservedCallTrait, // For compatibility with PHP 5.6. | |
| 1080 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. | |
| 1081 | 1081 | |
| 1082 | 1082 | private $document; | 
| 1083 | 1083 | private $handler; | 
| @@ -1089,14 +1089,14 @@ discard block | ||
| 1089 | 1089 | $this->document = $document; | 
| 1090 | 1090 | $this->handler = $handler; | 
| 1091 | 1091 | |
| 1092 | -                if (! \is_array($context) && ! $context instanceof \Traversable) { | |
| 1092 | +                if (!\is_array($context) && !$context instanceof \Traversable) { | |
| 1093 | 1093 | // DOMDocument, DOMElement and DOMNode are not iterable. | 
| 1094 | 1094 | // DOMNodeList and FluidContext are iterable. | 
| 1095 | - $context = [ $context ]; | |
| 1095 | + $context = [$context]; | |
| 1096 | 1096 | } | 
| 1097 | 1097 | |
| 1098 | 1098 |                  foreach ($context as $n) { | 
| 1099 | -                        if (! $n instanceof \DOMNode) { | |
| 1099 | +                        if (!$n instanceof \DOMNode) { | |
| 1100 | 1100 |                                  throw new \Exception('Node type not recognized.'); | 
| 1101 | 1101 | } | 
| 1102 | 1102 | |
| @@ -1309,7 +1309,7 @@ discard block | ||
| 1309 | 1309 | // the user has passed two arguments: | 
| 1310 | 1310 | // 1. is the attribute name | 
| 1311 | 1311 | // 2. is the attribute value | 
| 1312 | -                if (! \is_array($arguments[0])) { | |
| 1312 | +                if (!\is_array($arguments[0])) { | |
| 1313 | 1313 | $attrs = [$arguments[0] => $arguments[1]]; | 
| 1314 | 1314 | } | 
| 1315 | 1315 | |
| @@ -1442,7 +1442,7 @@ discard block | ||
| 1442 | 1442 | $found = ($r === $u) || $found; | 
| 1443 | 1443 | } | 
| 1444 | 1444 | |
| 1445 | -                        if (! $found) { | |
| 1445 | +                        if (!$found) { | |
| 1446 | 1446 | $set[] = $r; | 
| 1447 | 1447 | } | 
| 1448 | 1448 | } |