1 | <?php |
||
8 | abstract class DOMDocument |
||
9 | { |
||
10 | /** |
||
11 | * Coverts the given array to a \DOMDocument. |
||
12 | * |
||
13 | * @param array $array The array to covert. |
||
14 | * |
||
15 | * @return \DOMDocument |
||
16 | */ |
||
17 | final public static function fromArray(array $array) |
||
26 | |||
27 | /** |
||
28 | * Converts the given \DOMDocument to an array. |
||
29 | * |
||
30 | * @param \DOMDocument $document The document to convert. |
||
31 | * |
||
32 | * @return array |
||
33 | */ |
||
34 | final public static function toArray(\DOMDocument $document) |
||
44 | |||
45 | /** |
||
46 | * Helper method to add a new \DOMNode to the given document with the given value. |
||
47 | * |
||
48 | * @param \DOMDocument $document The document to which the node will be added. |
||
49 | * @param string $xpath A valid xpath destination of the new node. |
||
50 | * @param mixed $value The value for the new node. |
||
51 | * |
||
52 | * @return void |
||
53 | * |
||
54 | * @throws \DOMException Thrown if the given $xpath is not valid. |
||
55 | */ |
||
56 | final public static function addXPath(\DOMDocument $document, $xpath, $value = null) |
||
76 | |||
77 | /** |
||
78 | * Helper method to create element(s) from the given tagName. |
||
79 | * |
||
80 | * @param \DOMXPath $domXPath The DOMXPath object built using the owner document. |
||
81 | * @param \DOMNode $context The node to which the new elements will be added. |
||
82 | * @param string $fragment The tag name of the element. |
||
83 | * |
||
84 | * @return \DOMElement|\DOMAttr The DOMNode that was created. |
||
85 | */ |
||
86 | final private static function parseFragment(\DOMXPath $domXPath, \DOMNode $context, $fragment) |
||
139 | |||
140 | /** |
||
141 | * Helper method to add multiple identical nodes to the given context node. |
||
142 | * |
||
143 | * @param \DOMDocument $document The parent document. |
||
144 | * @param \DOMNode $context The node to which the new elements will be added. |
||
145 | * @param string $tagName The tag name of the element. |
||
146 | * @param integer $limit The number of elements to create. |
||
147 | * |
||
148 | * @return void |
||
149 | */ |
||
150 | final private static function addMultiple(\DOMDocument $document, \DOMNode $context, $tagName, $limit) |
||
156 | |||
157 | /** |
||
158 | * Helper method to create all sub elements in the given array based on the given xpath. |
||
159 | * |
||
160 | * @param array $array The array to which the new elements will be added. |
||
161 | * @param string $path The xpath defining the new elements. |
||
162 | * @param mixed $value The value for the last child element. |
||
163 | * |
||
164 | * @return void |
||
165 | */ |
||
166 | final private static function pathToArray(array &$array, $path, $value = null) |
||
186 | |||
187 | /** |
||
188 | * Helper method to ensure the value at the given $key is an array. |
||
189 | * |
||
190 | * @param array $array The array for which element $key should be checked. |
||
191 | * @param string $key The key for which the value will be made into an array. |
||
192 | * |
||
193 | * @return void |
||
194 | */ |
||
195 | final private static function arrayize(array &$array, $key) |
||
208 | |||
209 | /** |
||
210 | * Helper method to flatten a multi-dimensional array into a single dimensional array whose keys are xpaths. |
||
211 | * |
||
212 | * @param array $array The array to flatten. |
||
213 | * @param string $prefix The prefix to recursively add to the flattened keys. |
||
214 | * |
||
215 | * @return array |
||
216 | */ |
||
217 | final private static function flatten(array $array, $prefix = '') |
||
237 | } |
||
238 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.