@@ -70,7 +70,7 @@ discard block  | 
                                                    ||
| 70 | 70 | *  | 
                                                        
| 71 | 71 | * @param array $arguments Options that influence the construction of the XML document.  | 
                                                        
| 72 | 72 | *  | 
                                                        
| 73 | - * @return FluidXml A new FluidXml instance.  | 
                                                        |
| 73 | + * @return FluidContext A new FluidXml instance.  | 
                                                        |
| 74 | 74 | */  | 
                                                        
| 75 | 75 | function fluidify(...$arguments)  | 
                                                        
| 76 | 76 |  { | 
                                                        
@@ -87,6 +87,9 @@ discard block  | 
                                                    ||
| 87 | 87 | return new FluidNamespace(...$arguments);  | 
                                                        
| 88 | 88 | }  | 
                                                        
| 89 | 89 | |
| 90 | +/**  | 
                                                        |
| 91 | + * @param string $string  | 
                                                        |
| 92 | + */  | 
                                                        |
| 90 | 93 | function is_an_xml_string($string)  | 
                                                        
| 91 | 94 |  { | 
                                                        
| 92 | 95 | // Removes any empty new line at the beginning,  | 
                                                        
@@ -532,7 +535,7 @@ discard block  | 
                                                    ||
| 532 | 535 |           * $xml->query("/doc")->query("book[@id='123']"); | 
                                                        
| 533 | 536 | * ```  | 
                                                        
| 534 | 537 | *  | 
                                                        
| 535 | - * @param string $xpath The XPath to execute.  | 
                                                        |
| 538 | + * @param string[] $xpath The XPath to execute.  | 
                                                        |
| 536 | 539 | *  | 
                                                        
| 537 | 540 | * @return FluidContext The context associated to the DOMNodeList.  | 
                                                        
| 538 | 541 | */  | 
                                                        
@@ -572,6 +575,10 @@ discard block  | 
                                                    ||
| 572 | 575 | public function remove(...$xpath);  | 
                                                        
| 573 | 576 | public function xml($strip = false);  | 
                                                        
| 574 | 577 | // Aliases:  | 
                                                        
| 578 | +  | 
                                                        |
| 579 | + /**  | 
                                                        |
| 580 | + * @return FluidContext  | 
                                                        |
| 581 | + */  | 
                                                        |
| 575 | 582 | public function add($child, ...$optionals);  | 
                                                        
| 576 | 583 | public function prepend($sibling, ...$optionals);  | 
                                                        
| 577 | 584 | public function insertSiblingBefore($sibling, ...$optionals);  | 
                                                        
@@ -635,6 +642,9 @@ discard block  | 
                                                    ||
| 635 | 642 | private $context;  | 
                                                        
| 636 | 643 | private $times;  | 
                                                        
| 637 | 644 | |
| 645 | + /**  | 
                                                        |
| 646 | + * @param FluidContext $context  | 
                                                        |
| 647 | + */  | 
                                                        |
| 638 | 648 | public function __construct($document, $handler, $context, $times)  | 
                                                        
| 639 | 649 |          { | 
                                                        
| 640 | 650 | $this->document = $document;  | 
                                                        
@@ -667,6 +677,9 @@ discard block  | 
                                                    ||
| 667 | 677 | private $dom;  | 
                                                        
| 668 | 678 | private $namespaces;  | 
                                                        
| 669 | 679 | |
| 680 | + /**  | 
                                                        |
| 681 | + * @param FluidDocument $document  | 
                                                        |
| 682 | + */  | 
                                                        |
| 670 | 683 | public function __construct($document)  | 
                                                        
| 671 | 684 |          { | 
                                                        
| 672 | 685 | $this->document = $document;  | 
                                                        
@@ -908,6 +921,10 @@ discard block  | 
                                                    ||
| 908 | 921 | return $context;  | 
                                                        
| 909 | 922 | }  | 
                                                        
| 910 | 923 | |
| 924 | + /**  | 
                                                        |
| 925 | + * @param string $k  | 
                                                        |
| 926 | + * @param string $v  | 
                                                        |
| 927 | + */  | 
                                                        |
| 911 | 928 | protected function insertSpecialContent($parent, $k, $v)  | 
                                                        
| 912 | 929 |          { | 
                                                        
| 913 | 930 | // The user has passed an element text content:  | 
                                                        
@@ -925,6 +942,10 @@ discard block  | 
                                                    ||
| 925 | 942 | return [];  | 
                                                        
| 926 | 943 | }  | 
                                                        
| 927 | 944 | |
| 945 | + /**  | 
                                                        |
| 946 | + * @param string $k  | 
                                                        |
| 947 | + * @param string $v  | 
                                                        |
| 948 | + */  | 
                                                        |
| 928 | 949 | protected function insertSpecialAttribute($parent, $k, $v)  | 
                                                        
| 929 | 950 |          { | 
                                                        
| 930 | 951 | // The user has passed an attribute name and an attribute value:  | 
                                                        
@@ -936,6 +957,10 @@ discard block  | 
                                                    ||
| 936 | 957 | return [];  | 
                                                        
| 937 | 958 | }  | 
                                                        
| 938 | 959 | |
| 960 | + /**  | 
                                                        |
| 961 | + * @param string $k  | 
                                                        |
| 962 | + * @param string $v  | 
                                                        |
| 963 | + */  | 
                                                        |
| 939 | 964 | protected function insertStringString($parent, $k, $v, $fn)  | 
                                                        
| 940 | 965 |          { | 
                                                        
| 941 | 966 | // The user has passed an element name and an element value:  | 
                                                        
@@ -947,6 +972,9 @@ discard block  | 
                                                    ||
| 947 | 972 | return [ $el ];  | 
                                                        
| 948 | 973 | }  | 
                                                        
| 949 | 974 | |
| 975 | + /**  | 
                                                        |
| 976 | + * @param string $k  | 
                                                        |
| 977 | + */  | 
                                                        |
| 950 | 978 | protected function insertStringMixed($parent, $k, $v, $fn, &$optionals)  | 
                                                        
| 951 | 979 |          { | 
                                                        
| 952 | 980 | // The user has passed one of these two cases:  | 
                                                        
@@ -963,6 +991,9 @@ discard block  | 
                                                    ||
| 963 | 991 | return [ $el ];  | 
                                                        
| 964 | 992 | }  | 
                                                        
| 965 | 993 | |
| 994 | + /**  | 
                                                        |
| 995 | + * @param integer $k  | 
                                                        |
| 996 | + */  | 
                                                        |
| 966 | 997 | protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals)  | 
                                                        
| 967 | 998 |          { | 
                                                        
| 968 | 999 | // The user has passed a wrapper array:  | 
                                                        
@@ -979,6 +1010,10 @@ discard block  | 
                                                    ||
| 979 | 1010 | return $context;  | 
                                                        
| 980 | 1011 | }  | 
                                                        
| 981 | 1012 | |
| 1013 | + /**  | 
                                                        |
| 1014 | + * @param integer $k  | 
                                                        |
| 1015 | + * @param string $v  | 
                                                        |
| 1016 | + */  | 
                                                        |
| 982 | 1017 | protected function insertIntegerString($parent, $k, $v, $fn)  | 
                                                        
| 983 | 1018 |          { | 
                                                        
| 984 | 1019 | // The user has passed a node name without a node value:  | 
                                                        
@@ -990,6 +1025,10 @@ discard block  | 
                                                    ||
| 990 | 1025 | return [ $el ];  | 
                                                        
| 991 | 1026 | }  | 
                                                        
| 992 | 1027 | |
| 1028 | + /**  | 
                                                        |
| 1029 | + * @param integer $k  | 
                                                        |
| 1030 | + * @param string $v  | 
                                                        |
| 1031 | + */  | 
                                                        |
| 993 | 1032 | protected function insertIntegerXml($parent, $k, $v, $fn)  | 
                                                        
| 994 | 1033 |          { | 
                                                        
| 995 | 1034 | // The user has passed an XML document instance:  | 
                                                        
@@ -1019,6 +1058,10 @@ discard block  | 
                                                    ||
| 1019 | 1058 | return $this->attachNodes($parent, $nodes, $fn);  | 
                                                        
| 1020 | 1059 | }  | 
                                                        
| 1021 | 1060 | |
| 1061 | + /**  | 
                                                        |
| 1062 | + * @param integer $k  | 
                                                        |
| 1063 | + * @param \DOMDocument $v  | 
                                                        |
| 1064 | + */  | 
                                                        |
| 1022 | 1065 | protected function insertIntegerDomdocument($parent, $k, $v, $fn)  | 
                                                        
| 1023 | 1066 |          { | 
                                                        
| 1024 | 1067 | // A DOMDocument can have multiple root nodes.  | 
                                                        
@@ -1030,26 +1073,46 @@ discard block  | 
                                                    ||
| 1030 | 1073 | // return $this->attachNodes($parent, $v->documentElement, $fn);  | 
                                                        
| 1031 | 1074 | }  | 
                                                        
| 1032 | 1075 | |
| 1076 | + /**  | 
                                                        |
| 1077 | + * @param integer $k  | 
                                                        |
| 1078 | + * @param \DOMNodeList $v  | 
                                                        |
| 1079 | + */  | 
                                                        |
| 1033 | 1080 | protected function insertIntegerDomnodelist($parent, $k, $v, $fn)  | 
                                                        
| 1034 | 1081 |          { | 
                                                        
| 1035 | 1082 | return $this->attachNodes($parent, $v, $fn);  | 
                                                        
| 1036 | 1083 | }  | 
                                                        
| 1037 | 1084 | |
| 1085 | + /**  | 
                                                        |
| 1086 | + * @param integer $k  | 
                                                        |
| 1087 | + * @param \DOMNode $v  | 
                                                        |
| 1088 | + */  | 
                                                        |
| 1038 | 1089 | protected function insertIntegerDomnode($parent, $k, $v, $fn)  | 
                                                        
| 1039 | 1090 |          { | 
                                                        
| 1040 | 1091 | return $this->attachNodes($parent, $v, $fn);  | 
                                                        
| 1041 | 1092 | }  | 
                                                        
| 1042 | 1093 | |
| 1094 | + /**  | 
                                                        |
| 1095 | + * @param integer $k  | 
                                                        |
| 1096 | + * @param \SimpleXMLElement $v  | 
                                                        |
| 1097 | + */  | 
                                                        |
| 1043 | 1098 | protected function insertIntegerSimplexml($parent, $k, $v, $fn)  | 
                                                        
| 1044 | 1099 |          { | 
                                                        
| 1045 | 1100 | return $this->attachNodes($parent, \dom_import_simplexml($v), $fn);  | 
                                                        
| 1046 | 1101 | }  | 
                                                        
| 1047 | 1102 | |
| 1103 | + /**  | 
                                                        |
| 1104 | + * @param integer $k  | 
                                                        |
| 1105 | + * @param FluidXml $v  | 
                                                        |
| 1106 | + */  | 
                                                        |
| 1048 | 1107 | protected function insertIntegerFluidxml($parent, $k, $v, $fn)  | 
                                                        
| 1049 | 1108 |          { | 
                                                        
| 1050 | 1109 | return $this->attachNodes($parent, $v->dom()->documentElement, $fn);  | 
                                                        
| 1051 | 1110 | }  | 
                                                        
| 1052 | 1111 | |
| 1112 | + /**  | 
                                                        |
| 1113 | + * @param integer $k  | 
                                                        |
| 1114 | + * @param FluidContext $v  | 
                                                        |
| 1115 | + */  | 
                                                        |
| 1053 | 1116 | protected function insertIntegerFluidcontext($parent, $k, $v, $fn)  | 
                                                        
| 1054 | 1117 |          { | 
                                                        
| 1055 | 1118 | return $this->attachNodes($parent, $v->asArray(), $fn);  | 
                                                        
@@ -1433,6 +1496,9 @@ discard block  | 
                                                    ||
| 1433 | 1496 | return $set;  | 
                                                        
| 1434 | 1497 | }  | 
                                                        
| 1435 | 1498 | |
| 1499 | + /**  | 
                                                        |
| 1500 | + * @param callable $fn  | 
                                                        |
| 1501 | + */  | 
                                                        |
| 1436 | 1502 | protected function callfn($fn, $args)  | 
                                                        
| 1437 | 1503 |          { | 
                                                        
| 1438 | 1504 |                  if ($fn instanceof \Closure) { |