@@ -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) { |