1 | <?php |
||
51 | class XMLStream implements EventManagerAwareInterface |
||
52 | { |
||
53 | |||
54 | const NAMESPACE_SEPARATOR = ':'; |
||
55 | |||
56 | /** |
||
57 | * Eventmanager. |
||
58 | * |
||
59 | * @var EventManagerInterface |
||
60 | */ |
||
61 | protected $events; |
||
62 | |||
63 | /** |
||
64 | * Document encoding. |
||
65 | * |
||
66 | * @var string |
||
67 | */ |
||
68 | protected $encoding; |
||
69 | |||
70 | /** |
||
71 | * Current parsing depth. |
||
72 | * |
||
73 | * @var integer |
||
74 | */ |
||
75 | protected $depth = 0; |
||
76 | |||
77 | /** |
||
78 | * |
||
79 | * @var \DOMDocument |
||
80 | */ |
||
81 | protected $document; |
||
82 | |||
83 | /** |
||
84 | * Collected namespaces. |
||
85 | * |
||
86 | * @var array |
||
87 | */ |
||
88 | protected $namespaces = []; |
||
89 | |||
90 | /** |
||
91 | * Cache of namespace prefixes. |
||
92 | * |
||
93 | * @var array |
||
94 | */ |
||
95 | protected $namespacePrefixes = []; |
||
96 | |||
97 | /** |
||
98 | * Element cache. |
||
99 | * |
||
100 | * @var array |
||
101 | */ |
||
102 | protected $elements = []; |
||
103 | |||
104 | /** |
||
105 | * XML parser. |
||
106 | * |
||
107 | * @var resource |
||
108 | */ |
||
109 | protected $parser; |
||
110 | |||
111 | /** |
||
112 | * Event object. |
||
113 | * |
||
114 | * @var XMLEventInterface |
||
115 | */ |
||
116 | protected $eventObject; |
||
117 | |||
118 | /** |
||
119 | * Collected events while parsing. |
||
120 | * |
||
121 | * @var array |
||
122 | */ |
||
123 | protected $eventCache = []; |
||
124 | |||
125 | /** |
||
126 | * Constructor. |
||
127 | */ |
||
128 | 3 | public function __construct($encoding = 'UTF-8', XMLEventInterface $eventObject = null) |
|
139 | |||
140 | /** |
||
141 | * Free XML parser on desturct. |
||
142 | */ |
||
143 | public function __destruct() |
||
147 | |||
148 | /** |
||
149 | * Parse XML data and trigger events. |
||
150 | * |
||
151 | * @param string $source XML source |
||
152 | * @return \DOMDocument |
||
153 | */ |
||
154 | 21 | public function parse($source) |
|
173 | |||
174 | /** |
||
175 | * Clear document. |
||
176 | * |
||
177 | * Method resets the parser instance if <?xml is found. Overwise it clears the DOM document. |
||
178 | * |
||
179 | * @return void |
||
180 | */ |
||
181 | 6 | protected function clearDocument($source) |
|
202 | |||
203 | /** |
||
204 | * Starting tag found. |
||
205 | * |
||
206 | * @param resource $parser XML parser |
||
|
|||
207 | * @param string $name Element name |
||
208 | * @param attribs $attribs Element attributes |
||
209 | * @return void |
||
210 | */ |
||
211 | 3 | protected function startXml() |
|
265 | |||
266 | /** |
||
267 | * Turn attribes into attribute nodes. |
||
268 | * |
||
269 | * @param array $attribs Attributes |
||
270 | * @return array |
||
271 | */ |
||
272 | 3 | protected function createAttributeNodes(array $attribs) |
|
289 | |||
290 | /** |
||
291 | * End tag found. |
||
292 | * |
||
293 | * @return void |
||
294 | */ |
||
295 | 6 | protected function endXml() |
|
321 | |||
322 | /** |
||
323 | * Data found. |
||
324 | * |
||
325 | * @param resource $parser XML parser |
||
326 | * @param string $data Element data |
||
327 | * @return void |
||
328 | */ |
||
329 | 3 | protected function dataXml() |
|
337 | |||
338 | /** |
||
339 | * Add event to cache. |
||
340 | * |
||
341 | * @param string $event |
||
342 | * @param boolean $startTag |
||
343 | * @param array $params |
||
344 | * @return void |
||
345 | */ |
||
346 | 3 | protected function cacheEvent($event, $startTag, $params) |
|
350 | |||
351 | /** |
||
352 | * Trigger cached events |
||
353 | * |
||
354 | * @return void |
||
355 | */ |
||
356 | 3 | protected function trigger() |
|
365 | |||
366 | /** |
||
367 | * Reset class properties. |
||
368 | * |
||
369 | * @return void |
||
370 | */ |
||
371 | 3 | public function reset() |
|
389 | |||
390 | /** |
||
391 | * Get XML parser resource. |
||
392 | * |
||
393 | * @return resource |
||
394 | */ |
||
395 | public function getParser() |
||
399 | |||
400 | /** |
||
401 | * {@inheritDoc} |
||
402 | */ |
||
403 | 6 | public function getEventManager() |
|
411 | |||
412 | /** |
||
413 | * {@inheritDoc} |
||
414 | */ |
||
415 | 6 | public function setEventManager(EventManagerInterface $events) |
|
421 | |||
422 | /** |
||
423 | * Get event object. |
||
424 | * |
||
425 | * @return XMLEventInterface |
||
426 | */ |
||
427 | 3 | public function getEventObject() |
|
431 | |||
432 | /** |
||
433 | * Set event object. |
||
434 | * |
||
435 | * @param XMLEventInterface $eventObject |
||
436 | * @return $this |
||
437 | */ |
||
438 | public function setEventObject(XMLEventInterface $eventObject) |
||
443 | } |
||
444 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.