1 | <?php |
||
25 | class Dom |
||
26 | { |
||
27 | private $dom; |
||
28 | |||
29 | /** |
||
30 | * Constructor. |
||
31 | * |
||
32 | * @param string $content |
||
33 | * |
||
34 | * @throws \DomException |
||
35 | */ |
||
36 | public function __construct($content) |
||
51 | |||
52 | /** |
||
53 | * __toString. |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | public function __toString() |
||
63 | |||
64 | /** |
||
65 | * validate. |
||
66 | * |
||
67 | * @throws \DomException |
||
68 | */ |
||
69 | public function validate() |
||
74 | |||
75 | /** |
||
76 | * validateXsd. |
||
77 | * |
||
78 | * @param string $xsd |
||
79 | * |
||
80 | * @throws \DomException |
||
81 | */ |
||
82 | public function validateXsd($xsd) |
||
87 | |||
88 | /** |
||
89 | * validateNg. |
||
90 | * |
||
91 | * @param string $ng |
||
92 | * |
||
93 | * @throws \RuntimeException |
||
94 | */ |
||
95 | public function validateNg($ng) |
||
104 | |||
105 | /** |
||
106 | * xpath. |
||
107 | * |
||
108 | * @param string $element |
||
109 | * |
||
110 | * @return DOMNodeList |
||
111 | */ |
||
112 | public function xpath($element) |
||
122 | |||
123 | /** |
||
124 | * getNamespaces. |
||
125 | * |
||
126 | * @return string |
||
127 | */ |
||
128 | public function getNamespaces() |
||
134 | |||
135 | /** |
||
136 | * registerNamespace. |
||
137 | * |
||
138 | * @param \DOMXpath $xpath |
||
139 | */ |
||
140 | private function registerNamespace(\DOMXpath $xpath) |
||
151 | |||
152 | /** |
||
153 | * "fix" queries to the default namespace if any namespaces are defined. |
||
154 | * |
||
155 | * @param string $element |
||
156 | */ |
||
157 | private function fixNamespace($element) |
||
170 | |||
171 | private function hasDefaultNamespace() |
||
178 | |||
179 | private function throwError() |
||
189 | } |
||
190 |
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.