Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 463 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
HTMLBaseElement | |
0.00% |
0 / 463 |
|
0.00% |
0 / 6 |
48180 | |
0.00% |
0 / 1 |
_getMissingProp | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
_setMissingProp | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
__get | |
0.00% |
0 / 122 |
|
0.00% |
0 / 1 |
3906 | |||
__isset | |
0.00% |
0 / 122 |
|
0.00% |
0 / 1 |
3906 | |||
__set | |
0.00% |
0 / 83 |
|
0.00% |
0 / 1 |
870 | |||
__unset | |
0.00% |
0 / 134 |
|
0.00% |
0 / 1 |
4160 | |||
getTarget | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTarget | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | // AUTOMATICALLY GENERATED. DO NOT EDIT. |
4 | // Use `composer build` to regenerate. |
5 | |
6 | namespace Wikimedia\IDLeDOM\Helper; |
7 | |
8 | trait HTMLBaseElement { |
9 | |
10 | // Underscore is used to avoid conflicts with DOM-reserved names |
11 | // phpcs:disable PSR2.Methods.MethodDeclaration.Underscore |
12 | // phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName |
13 | |
14 | /** |
15 | * Handle an attempt to get a non-existing property on this |
16 | * object. The default implementation raises an exception |
17 | * but the implementor can choose a different behavior: |
18 | * return null (like JavaScript), dynamically create the |
19 | * property, etc. |
20 | * @param string $prop the name of the property requested |
21 | * @return mixed |
22 | */ |
23 | abstract protected function _getMissingProp( string $prop ); |
24 | |
25 | /** |
26 | * Handle an attempt to set a non-existing property on this |
27 | * object. The default implementation raises an exception |
28 | * but the implementor can choose a different behavior: |
29 | * ignore the operation (like JavaScript), dynamically create |
30 | * the property, etc. |
31 | * @param string $prop the name of the property requested |
32 | * @param mixed $value the value to set |
33 | */ |
34 | abstract protected function _setMissingProp( string $prop, $value ): void; |
35 | |
36 | // phpcs:enable |
37 | |
38 | /** |
39 | * @param string $name |
40 | * @return mixed |
41 | */ |
42 | public function __get( string $name ) { |
43 | '@phan-var \Wikimedia\IDLeDOM\HTMLBaseElement $this'; |
44 | // @var \Wikimedia\IDLeDOM\HTMLBaseElement $this |
45 | switch ( $name ) { |
46 | case "nodeType": |
47 | return $this->getNodeType(); |
48 | case "nodeName": |
49 | return $this->getNodeName(); |
50 | case "baseURI": |
51 | return $this->getBaseURI(); |
52 | case "isConnected": |
53 | return $this->getIsConnected(); |
54 | case "ownerDocument": |
55 | return $this->getOwnerDocument(); |
56 | case "parentNode": |
57 | return $this->getParentNode(); |
58 | case "parentElement": |
59 | return $this->getParentElement(); |
60 | case "childNodes": |
61 | return $this->getChildNodes(); |
62 | case "firstChild": |
63 | return $this->getFirstChild(); |
64 | case "lastChild": |
65 | return $this->getLastChild(); |
66 | case "previousSibling": |
67 | return $this->getPreviousSibling(); |
68 | case "nextSibling": |
69 | return $this->getNextSibling(); |
70 | case "nodeValue": |
71 | return $this->getNodeValue(); |
72 | case "textContent": |
73 | return $this->getTextContent(); |
74 | case "innerHTML": |
75 | return $this->getInnerHTML(); |
76 | case "previousElementSibling": |
77 | return $this->getPreviousElementSibling(); |
78 | case "nextElementSibling": |
79 | return $this->getNextElementSibling(); |
80 | case "children": |
81 | return $this->getChildren(); |
82 | case "firstElementChild": |
83 | return $this->getFirstElementChild(); |
84 | case "lastElementChild": |
85 | return $this->getLastElementChild(); |
86 | case "childElementCount": |
87 | return $this->getChildElementCount(); |
88 | case "assignedSlot": |
89 | return $this->getAssignedSlot(); |
90 | case "namespaceURI": |
91 | return $this->getNamespaceURI(); |
92 | case "prefix": |
93 | return $this->getPrefix(); |
94 | case "localName": |
95 | return $this->getLocalName(); |
96 | case "tagName": |
97 | return $this->getTagName(); |
98 | case "id": |
99 | return $this->getId(); |
100 | case "className": |
101 | return $this->getClassName(); |
102 | case "classList": |
103 | return $this->getClassList(); |
104 | case "slot": |
105 | return $this->getSlot(); |
106 | case "attributes": |
107 | return $this->getAttributes(); |
108 | case "shadowRoot": |
109 | return $this->getShadowRoot(); |
110 | case "outerHTML": |
111 | return $this->getOuterHTML(); |
112 | case "style": |
113 | return $this->getStyle(); |
114 | case "contentEditable": |
115 | return $this->getContentEditable(); |
116 | case "enterKeyHint": |
117 | return $this->getEnterKeyHint(); |
118 | case "isContentEditable": |
119 | return $this->getIsContentEditable(); |
120 | case "inputMode": |
121 | return $this->getInputMode(); |
122 | case "onload": |
123 | return $this->getOnload(); |
124 | case "dataset": |
125 | return $this->getDataset(); |
126 | case "nonce": |
127 | return $this->getNonce(); |
128 | case "tabIndex": |
129 | return $this->getTabIndex(); |
130 | case "title": |
131 | return $this->getTitle(); |
132 | case "lang": |
133 | return $this->getLang(); |
134 | case "translate": |
135 | return $this->getTranslate(); |
136 | case "dir": |
137 | return $this->getDir(); |
138 | case "hidden": |
139 | return $this->getHidden(); |
140 | case "accessKey": |
141 | return $this->getAccessKey(); |
142 | case "accessKeyLabel": |
143 | return $this->getAccessKeyLabel(); |
144 | case "draggable": |
145 | return $this->getDraggable(); |
146 | case "spellcheck": |
147 | return $this->getSpellcheck(); |
148 | case "autocapitalize": |
149 | return $this->getAutocapitalize(); |
150 | case "innerText": |
151 | return $this->getInnerText(); |
152 | case "offsetParent": |
153 | return $this->getOffsetParent(); |
154 | case "offsetTop": |
155 | return $this->getOffsetTop(); |
156 | case "offsetLeft": |
157 | return $this->getOffsetLeft(); |
158 | case "offsetWidth": |
159 | return $this->getOffsetWidth(); |
160 | case "offsetHeight": |
161 | return $this->getOffsetHeight(); |
162 | case "href": |
163 | return $this->getHref(); |
164 | case "target": |
165 | return $this->getTarget(); |
166 | default: |
167 | break; |
168 | } |
169 | '@phan-var \Wikimedia\IDLeDOM\Helper\HTMLBaseElement $this'; |
170 | // @var \Wikimedia\IDLeDOM\Helper\HTMLBaseElement $this |
171 | return $this->_getMissingProp( $name ); |
172 | } |
173 | |
174 | /** |
175 | * @param string $name |
176 | * @return bool |
177 | */ |
178 | public function __isset( string $name ): bool { |
179 | '@phan-var \Wikimedia\IDLeDOM\HTMLBaseElement $this'; |
180 | // @var \Wikimedia\IDLeDOM\HTMLBaseElement $this |
181 | switch ( $name ) { |
182 | case "nodeType": |
183 | return true; |
184 | case "nodeName": |
185 | return true; |
186 | case "baseURI": |
187 | return true; |
188 | case "isConnected": |
189 | return true; |
190 | case "ownerDocument": |
191 | return $this->getOwnerDocument() !== null; |
192 | case "parentNode": |
193 | return $this->getParentNode() !== null; |
194 | case "parentElement": |
195 | return $this->getParentElement() !== null; |
196 | case "childNodes": |
197 | return true; |
198 | case "firstChild": |
199 | return $this->getFirstChild() !== null; |
200 | case "lastChild": |
201 | return $this->getLastChild() !== null; |
202 | case "previousSibling": |
203 | return $this->getPreviousSibling() !== null; |
204 | case "nextSibling": |
205 | return $this->getNextSibling() !== null; |
206 | case "nodeValue": |
207 | return $this->getNodeValue() !== null; |
208 | case "textContent": |
209 | return $this->getTextContent() !== null; |
210 | case "innerHTML": |
211 | return true; |
212 | case "previousElementSibling": |
213 | return $this->getPreviousElementSibling() !== null; |
214 | case "nextElementSibling": |
215 | return $this->getNextElementSibling() !== null; |
216 | case "children": |
217 | return true; |
218 | case "firstElementChild": |
219 | return $this->getFirstElementChild() !== null; |
220 | case "lastElementChild": |
221 | return $this->getLastElementChild() !== null; |
222 | case "childElementCount": |
223 | return true; |
224 | case "assignedSlot": |
225 | return $this->getAssignedSlot() !== null; |
226 | case "namespaceURI": |
227 | return $this->getNamespaceURI() !== null; |
228 | case "prefix": |
229 | return $this->getPrefix() !== null; |
230 | case "localName": |
231 | return true; |
232 | case "tagName": |
233 | return true; |
234 | case "id": |
235 | return true; |
236 | case "className": |
237 | return true; |
238 | case "classList": |
239 | return true; |
240 | case "slot": |
241 | return true; |
242 | case "attributes": |
243 | return true; |
244 | case "shadowRoot": |
245 | return $this->getShadowRoot() !== null; |
246 | case "outerHTML": |
247 | return true; |
248 | case "style": |
249 | return true; |
250 | case "contentEditable": |
251 | return true; |
252 | case "enterKeyHint": |
253 | return true; |
254 | case "isContentEditable": |
255 | return true; |
256 | case "inputMode": |
257 | return true; |
258 | case "onload": |
259 | return true; |
260 | case "dataset": |
261 | return true; |
262 | case "nonce": |
263 | return true; |
264 | case "tabIndex": |
265 | return true; |
266 | case "title": |
267 | return true; |
268 | case "lang": |
269 | return true; |
270 | case "translate": |
271 | return true; |
272 | case "dir": |
273 | return true; |
274 | case "hidden": |
275 | return true; |
276 | case "accessKey": |
277 | return true; |
278 | case "accessKeyLabel": |
279 | return true; |
280 | case "draggable": |
281 | return true; |
282 | case "spellcheck": |
283 | return true; |
284 | case "autocapitalize": |
285 | return true; |
286 | case "innerText": |
287 | return true; |
288 | case "offsetParent": |
289 | return $this->getOffsetParent() !== null; |
290 | case "offsetTop": |
291 | return true; |
292 | case "offsetLeft": |
293 | return true; |
294 | case "offsetWidth": |
295 | return true; |
296 | case "offsetHeight": |
297 | return true; |
298 | case "href": |
299 | return true; |
300 | case "target": |
301 | return true; |
302 | default: |
303 | break; |
304 | } |
305 | return false; |
306 | } |
307 | |
308 | /** |
309 | * @param string $name |
310 | * @param mixed $value |
311 | */ |
312 | public function __set( string $name, $value ): void { |
313 | '@phan-var \Wikimedia\IDLeDOM\HTMLBaseElement $this'; |
314 | // @var \Wikimedia\IDLeDOM\HTMLBaseElement $this |
315 | switch ( $name ) { |
316 | case "nodeValue": |
317 | $this->setNodeValue( $value ); |
318 | return; |
319 | case "textContent": |
320 | $this->setTextContent( $value ); |
321 | return; |
322 | case "innerHTML": |
323 | $this->setInnerHTML( $value ); |
324 | return; |
325 | case "id": |
326 | $this->setId( $value ); |
327 | return; |
328 | case "className": |
329 | $this->setClassName( $value ); |
330 | return; |
331 | case "classList": |
332 | $this->setClassList( $value ); |
333 | return; |
334 | case "slot": |
335 | $this->setSlot( $value ); |
336 | return; |
337 | case "outerHTML": |
338 | $this->setOuterHTML( $value ); |
339 | return; |
340 | case "style": |
341 | $this->setStyle( $value ); |
342 | return; |
343 | case "contentEditable": |
344 | $this->setContentEditable( $value ); |
345 | return; |
346 | case "enterKeyHint": |
347 | $this->setEnterKeyHint( $value ); |
348 | return; |
349 | case "inputMode": |
350 | $this->setInputMode( $value ); |
351 | return; |
352 | case "onload": |
353 | $this->setOnload( $value ); |
354 | return; |
355 | case "nonce": |
356 | $this->setNonce( $value ); |
357 | return; |
358 | case "tabIndex": |
359 | $this->setTabIndex( $value ); |
360 | return; |
361 | case "title": |
362 | $this->setTitle( $value ); |
363 | return; |
364 | case "lang": |
365 | $this->setLang( $value ); |
366 | return; |
367 | case "translate": |
368 | $this->setTranslate( $value ); |
369 | return; |
370 | case "dir": |
371 | $this->setDir( $value ); |
372 | return; |
373 | case "hidden": |
374 | $this->setHidden( $value ); |
375 | return; |
376 | case "accessKey": |
377 | $this->setAccessKey( $value ); |
378 | return; |
379 | case "draggable": |
380 | $this->setDraggable( $value ); |
381 | return; |
382 | case "spellcheck": |
383 | $this->setSpellcheck( $value ); |
384 | return; |
385 | case "autocapitalize": |
386 | $this->setAutocapitalize( $value ); |
387 | return; |
388 | case "innerText": |
389 | $this->setInnerText( $value ); |
390 | return; |
391 | case "href": |
392 | $this->setHref( $value ); |
393 | return; |
394 | case "target": |
395 | $this->setTarget( $value ); |
396 | return; |
397 | default: |
398 | break; |
399 | } |
400 | '@phan-var \Wikimedia\IDLeDOM\Helper\HTMLBaseElement $this'; |
401 | // @var \Wikimedia\IDLeDOM\Helper\HTMLBaseElement $this |
402 | $this->_setMissingProp( $name, $value ); |
403 | } |
404 | |
405 | /** |
406 | * @param string $name |
407 | */ |
408 | public function __unset( string $name ): void { |
409 | '@phan-var \Wikimedia\IDLeDOM\HTMLBaseElement $this'; |
410 | // @var \Wikimedia\IDLeDOM\HTMLBaseElement $this |
411 | switch ( $name ) { |
412 | case "nodeType": |
413 | break; |
414 | case "nodeName": |
415 | break; |
416 | case "baseURI": |
417 | break; |
418 | case "isConnected": |
419 | break; |
420 | case "ownerDocument": |
421 | break; |
422 | case "parentNode": |
423 | break; |
424 | case "parentElement": |
425 | break; |
426 | case "childNodes": |
427 | break; |
428 | case "firstChild": |
429 | break; |
430 | case "lastChild": |
431 | break; |
432 | case "previousSibling": |
433 | break; |
434 | case "nextSibling": |
435 | break; |
436 | case "nodeValue": |
437 | $this->setNodeValue( null ); |
438 | return; |
439 | case "textContent": |
440 | $this->setTextContent( null ); |
441 | return; |
442 | case "innerHTML": |
443 | break; |
444 | case "previousElementSibling": |
445 | break; |
446 | case "nextElementSibling": |
447 | break; |
448 | case "children": |
449 | break; |
450 | case "firstElementChild": |
451 | break; |
452 | case "lastElementChild": |
453 | break; |
454 | case "childElementCount": |
455 | break; |
456 | case "assignedSlot": |
457 | break; |
458 | case "namespaceURI": |
459 | break; |
460 | case "prefix": |
461 | break; |
462 | case "localName": |
463 | break; |
464 | case "tagName": |
465 | break; |
466 | case "id": |
467 | break; |
468 | case "className": |
469 | break; |
470 | case "classList": |
471 | break; |
472 | case "slot": |
473 | break; |
474 | case "attributes": |
475 | break; |
476 | case "shadowRoot": |
477 | break; |
478 | case "outerHTML": |
479 | break; |
480 | case "style": |
481 | break; |
482 | case "contentEditable": |
483 | break; |
484 | case "enterKeyHint": |
485 | break; |
486 | case "isContentEditable": |
487 | break; |
488 | case "inputMode": |
489 | break; |
490 | case "onload": |
491 | break; |
492 | case "dataset": |
493 | break; |
494 | case "nonce": |
495 | break; |
496 | case "tabIndex": |
497 | break; |
498 | case "title": |
499 | break; |
500 | case "lang": |
501 | break; |
502 | case "translate": |
503 | break; |
504 | case "dir": |
505 | break; |
506 | case "hidden": |
507 | break; |
508 | case "accessKey": |
509 | break; |
510 | case "accessKeyLabel": |
511 | break; |
512 | case "draggable": |
513 | break; |
514 | case "spellcheck": |
515 | break; |
516 | case "autocapitalize": |
517 | break; |
518 | case "innerText": |
519 | break; |
520 | case "offsetParent": |
521 | break; |
522 | case "offsetTop": |
523 | break; |
524 | case "offsetLeft": |
525 | break; |
526 | case "offsetWidth": |
527 | break; |
528 | case "offsetHeight": |
529 | break; |
530 | case "href": |
531 | break; |
532 | case "target": |
533 | break; |
534 | default: |
535 | return; |
536 | } |
537 | $trace = debug_backtrace(); |
538 | while ( |
539 | count( $trace ) > 0 && |
540 | $trace[0]['function'] !== "__unset" |
541 | ) { |
542 | array_shift( $trace ); |
543 | } |
544 | trigger_error( |
545 | 'Undefined property' . |
546 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name . |
547 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
548 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
549 | E_USER_NOTICE |
550 | ); |
551 | } |
552 | |
553 | /** |
554 | * @return string |
555 | */ |
556 | public function getTarget(): string { |
557 | '@phan-var \Wikimedia\IDLeDOM\Element $this'; |
558 | // @var \Wikimedia\IDLeDOM\Element $this |
559 | return $this->getAttribute( 'target' ) ?? ''; |
560 | } |
561 | |
562 | /** |
563 | * @param string $val |
564 | */ |
565 | public function setTarget( string $val ): void { |
566 | '@phan-var \Wikimedia\IDLeDOM\Element $this'; |
567 | // @var \Wikimedia\IDLeDOM\Element $this |
568 | $this->setAttribute( 'target', $val ); |
569 | } |
570 | |
571 | } |