| @@ -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, | 
| @@ -543,7 +546,7 @@ discard block | ||
| 543 | 546 |           * $xml->query("/doc")->query("book[@id='123']"); | 
| 544 | 547 | * ``` | 
| 545 | 548 | * | 
| 546 | - * @param string $xpath The XPath to execute. | |
| 549 | + * @param string[] $xpath The XPath to execute. | |
| 547 | 550 | * | 
| 548 | 551 | * @return FluidContext The context associated to the DOMNodeList. | 
| 549 | 552 | */ | 
| @@ -565,9 +568,6 @@ discard block | ||
| 565 | 568 | * ``` | 
| 566 | 569 | * | 
| 567 | 570 | * @param string|array $child The child/children to add. | 
| 568 | - * @param string $value The child text content. | |
| 569 | - * @param bool $switchContext Whether to return the current context | |
| 570 | - * or the context of the created node. | |
| 571 | 571 | * | 
| 572 | 572 | * @return FluidContext The context associated to the DOMNodeList. | 
| 573 | 573 | */ | 
| @@ -582,6 +582,10 @@ discard block | ||
| 582 | 582 | public function remove(...$xpath); | 
| 583 | 583 | public function xml($strip = false); | 
| 584 | 584 | // Aliases: | 
| 585 | + | |
| 586 | + /** | |
| 587 | + * @return FluidContext | |
| 588 | + */ | |
| 585 | 589 | public function add($child, ...$optionals); | 
| 586 | 590 | public function prepend($sibling, ...$optionals); | 
| 587 | 591 | public function insertSiblingBefore($sibling, ...$optionals); | 
| @@ -645,6 +649,9 @@ discard block | ||
| 645 | 649 | private $context; | 
| 646 | 650 | private $times; | 
| 647 | 651 | |
| 652 | + /** | |
| 653 | + * @param FluidContext $context | |
| 654 | + */ | |
| 648 | 655 | public function __construct($document, $handler, $context, $times) | 
| 649 | 656 |          { | 
| 650 | 657 | $this->document = $document; | 
| @@ -677,6 +684,9 @@ discard block | ||
| 677 | 684 | private $dom; | 
| 678 | 685 | private $namespaces; | 
| 679 | 686 | |
| 687 | + /** | |
| 688 | + * @param FluidDocument $document | |
| 689 | + */ | |
| 680 | 690 | public function __construct($document) | 
| 681 | 691 |          { | 
| 682 | 692 | $this->document = $document; | 
| @@ -923,6 +933,10 @@ discard block | ||
| 923 | 933 | return $context; | 
| 924 | 934 | } | 
| 925 | 935 | |
| 936 | + /** | |
| 937 | + * @param string $k | |
| 938 | + * @param string $v | |
| 939 | + */ | |
| 926 | 940 | protected function insertSpecialContent($parent, $k, $v) | 
| 927 | 941 |          { | 
| 928 | 942 | // The user has passed an element text content: | 
| @@ -940,6 +954,10 @@ discard block | ||
| 940 | 954 | return []; | 
| 941 | 955 | } | 
| 942 | 956 | |
| 957 | + /** | |
| 958 | + * @param string $k | |
| 959 | + * @param string $v | |
| 960 | + */ | |
| 943 | 961 | protected function insertSpecialAttribute($parent, $k, $v) | 
| 944 | 962 |          { | 
| 945 | 963 | // The user has passed an attribute name and an attribute value: | 
| @@ -951,6 +969,10 @@ discard block | ||
| 951 | 969 | return []; | 
| 952 | 970 | } | 
| 953 | 971 | |
| 972 | + /** | |
| 973 | + * @param string $k | |
| 974 | + * @param string $v | |
| 975 | + */ | |
| 954 | 976 | protected function insertStringString($parent, $k, $v, $fn) | 
| 955 | 977 |          { | 
| 956 | 978 | // The user has passed an element name and an element value: | 
| @@ -962,6 +984,9 @@ discard block | ||
| 962 | 984 | return [ $el ]; | 
| 963 | 985 | } | 
| 964 | 986 | |
| 987 | + /** | |
| 988 | + * @param string $k | |
| 989 | + */ | |
| 965 | 990 | protected function insertStringMixed($parent, $k, $v, $fn, &$optionals) | 
| 966 | 991 |          { | 
| 967 | 992 | // The user has passed one of these two cases: | 
| @@ -978,6 +1003,9 @@ discard block | ||
| 978 | 1003 | return [ $el ]; | 
| 979 | 1004 | } | 
| 980 | 1005 | |
| 1006 | + /** | |
| 1007 | + * @param integer $k | |
| 1008 | + */ | |
| 981 | 1009 | protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals) | 
| 982 | 1010 |          { | 
| 983 | 1011 | // The user has passed a wrapper array: | 
| @@ -994,6 +1022,10 @@ discard block | ||
| 994 | 1022 | return $context; | 
| 995 | 1023 | } | 
| 996 | 1024 | |
| 1025 | + /** | |
| 1026 | + * @param integer $k | |
| 1027 | + * @param string $v | |
| 1028 | + */ | |
| 997 | 1029 | protected function insertIntegerString($parent, $k, $v, $fn) | 
| 998 | 1030 |          { | 
| 999 | 1031 | // The user has passed a node name without a node value: | 
| @@ -1005,6 +1037,10 @@ discard block | ||
| 1005 | 1037 | return [ $el ]; | 
| 1006 | 1038 | } | 
| 1007 | 1039 | |
| 1040 | + /** | |
| 1041 | + * @param integer $k | |
| 1042 | + * @param string $v | |
| 1043 | + */ | |
| 1008 | 1044 | protected function insertIntegerXml($parent, $k, $v, $fn) | 
| 1009 | 1045 |          { | 
| 1010 | 1046 | // The user has passed an XML document instance: | 
| @@ -1034,6 +1070,10 @@ discard block | ||
| 1034 | 1070 | return $this->attachNodes($parent, $nodes, $fn); | 
| 1035 | 1071 | } | 
| 1036 | 1072 | |
| 1073 | + /** | |
| 1074 | + * @param integer $k | |
| 1075 | + * @param \DOMDocument $v | |
| 1076 | + */ | |
| 1037 | 1077 | protected function insertIntegerDomdocument($parent, $k, $v, $fn) | 
| 1038 | 1078 |          { | 
| 1039 | 1079 | // A DOMDocument can have multiple root nodes. | 
| @@ -1045,26 +1085,46 @@ discard block | ||
| 1045 | 1085 | // return $this->attachNodes($parent, $v->documentElement, $fn); | 
| 1046 | 1086 | } | 
| 1047 | 1087 | |
| 1088 | + /** | |
| 1089 | + * @param integer $k | |
| 1090 | + * @param \DOMNodeList $v | |
| 1091 | + */ | |
| 1048 | 1092 | protected function insertIntegerDomnodelist($parent, $k, $v, $fn) | 
| 1049 | 1093 |          { | 
| 1050 | 1094 | return $this->attachNodes($parent, $v, $fn); | 
| 1051 | 1095 | } | 
| 1052 | 1096 | |
| 1097 | + /** | |
| 1098 | + * @param integer $k | |
| 1099 | + * @param \DOMNode $v | |
| 1100 | + */ | |
| 1053 | 1101 | protected function insertIntegerDomnode($parent, $k, $v, $fn) | 
| 1054 | 1102 |          { | 
| 1055 | 1103 | return $this->attachNodes($parent, $v, $fn); | 
| 1056 | 1104 | } | 
| 1057 | 1105 | |
| 1106 | + /** | |
| 1107 | + * @param integer $k | |
| 1108 | + * @param \SimpleXMLElement $v | |
| 1109 | + */ | |
| 1058 | 1110 | protected function insertIntegerSimplexml($parent, $k, $v, $fn) | 
| 1059 | 1111 |          { | 
| 1060 | 1112 | return $this->attachNodes($parent, \dom_import_simplexml($v), $fn); | 
| 1061 | 1113 | } | 
| 1062 | 1114 | |
| 1115 | + /** | |
| 1116 | + * @param integer $k | |
| 1117 | + * @param FluidXml $v | |
| 1118 | + */ | |
| 1063 | 1119 | protected function insertIntegerFluidxml($parent, $k, $v, $fn) | 
| 1064 | 1120 |          { | 
| 1065 | 1121 | return $this->attachNodes($parent, $v->dom()->documentElement, $fn); | 
| 1066 | 1122 | } | 
| 1067 | 1123 | |
| 1124 | + /** | |
| 1125 | + * @param integer $k | |
| 1126 | + * @param FluidContext $v | |
| 1127 | + */ | |
| 1068 | 1128 | protected function insertIntegerFluidcontext($parent, $k, $v, $fn) | 
| 1069 | 1129 |          { | 
| 1070 | 1130 | return $this->attachNodes($parent, $v->asArray(), $fn); | 
| @@ -1450,6 +1510,9 @@ discard block | ||
| 1450 | 1510 | return $set; | 
| 1451 | 1511 | } | 
| 1452 | 1512 | |
| 1513 | + /** | |
| 1514 | + * @param callable $fn | |
| 1515 | + */ | |
| 1453 | 1516 | protected function callfn($fn, $args) | 
| 1454 | 1517 |          { | 
| 1455 | 1518 |                  if ($fn instanceof \Closure) { |