Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 495
0.00% covered (danger)
0.00%
0 / 21
CRAP
0.00% covered (danger)
0.00%
0 / 1
HTMLElement
0.00% covered (danger)
0.00%
0 / 495
0.00% covered (danger)
0.00%
0 / 21
63252
0.00% covered (danger)
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% covered (danger)
0.00%
0 / 118
0.00% covered (danger)
0.00%
0 / 1
3660
 __isset
0.00% covered (danger)
0.00%
0 / 118
0.00% covered (danger)
0.00%
0 / 1
3660
 __set
0.00% covered (danger)
0.00%
0 / 77
0.00% covered (danger)
0.00%
0 / 1
756
 __unset
0.00% covered (danger)
0.00%
0 / 130
0.00% covered (danger)
0.00%
0 / 1
3906
 setStyle
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getEnterKeyHint
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
110
 setEnterKeyHint
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getInputMode
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
132
 setInputMode
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getNonce
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setNonce
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getTitle
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setTitle
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getLang
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setLang
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDir
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
42
 setDir
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getHidden
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setHidden
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 getAccessKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setAccessKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3// AUTOMATICALLY GENERATED.  DO NOT EDIT.
4// Use `composer build` to regenerate.
5
6namespace Wikimedia\IDLeDOM\Helper;
7
8trait HTMLElement {
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\HTMLElement $this';
44        // @var \Wikimedia\IDLeDOM\HTMLElement $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            default:
163                break;
164        }
165        '@phan-var \Wikimedia\IDLeDOM\Helper\HTMLElement $this';
166        // @var \Wikimedia\IDLeDOM\Helper\HTMLElement $this
167        return $this->_getMissingProp( $name );
168    }
169
170    /**
171     * @param string $name
172     * @return bool
173     */
174    public function __isset( string $name ): bool {
175        '@phan-var \Wikimedia\IDLeDOM\HTMLElement $this';
176        // @var \Wikimedia\IDLeDOM\HTMLElement $this
177        switch ( $name ) {
178            case "nodeType":
179                return true;
180            case "nodeName":
181                return true;
182            case "baseURI":
183                return true;
184            case "isConnected":
185                return true;
186            case "ownerDocument":
187                return $this->getOwnerDocument() !== null;
188            case "parentNode":
189                return $this->getParentNode() !== null;
190            case "parentElement":
191                return $this->getParentElement() !== null;
192            case "childNodes":
193                return true;
194            case "firstChild":
195                return $this->getFirstChild() !== null;
196            case "lastChild":
197                return $this->getLastChild() !== null;
198            case "previousSibling":
199                return $this->getPreviousSibling() !== null;
200            case "nextSibling":
201                return $this->getNextSibling() !== null;
202            case "nodeValue":
203                return $this->getNodeValue() !== null;
204            case "textContent":
205                return $this->getTextContent() !== null;
206            case "innerHTML":
207                return true;
208            case "previousElementSibling":
209                return $this->getPreviousElementSibling() !== null;
210            case "nextElementSibling":
211                return $this->getNextElementSibling() !== null;
212            case "children":
213                return true;
214            case "firstElementChild":
215                return $this->getFirstElementChild() !== null;
216            case "lastElementChild":
217                return $this->getLastElementChild() !== null;
218            case "childElementCount":
219                return true;
220            case "assignedSlot":
221                return $this->getAssignedSlot() !== null;
222            case "namespaceURI":
223                return $this->getNamespaceURI() !== null;
224            case "prefix":
225                return $this->getPrefix() !== null;
226            case "localName":
227                return true;
228            case "tagName":
229                return true;
230            case "id":
231                return true;
232            case "className":
233                return true;
234            case "classList":
235                return true;
236            case "slot":
237                return true;
238            case "attributes":
239                return true;
240            case "shadowRoot":
241                return $this->getShadowRoot() !== null;
242            case "outerHTML":
243                return true;
244            case "style":
245                return true;
246            case "contentEditable":
247                return true;
248            case "enterKeyHint":
249                return true;
250            case "isContentEditable":
251                return true;
252            case "inputMode":
253                return true;
254            case "onload":
255                return true;
256            case "dataset":
257                return true;
258            case "nonce":
259                return true;
260            case "tabIndex":
261                return true;
262            case "title":
263                return true;
264            case "lang":
265                return true;
266            case "translate":
267                return true;
268            case "dir":
269                return true;
270            case "hidden":
271                return true;
272            case "accessKey":
273                return true;
274            case "accessKeyLabel":
275                return true;
276            case "draggable":
277                return true;
278            case "spellcheck":
279                return true;
280            case "autocapitalize":
281                return true;
282            case "innerText":
283                return true;
284            case "offsetParent":
285                return $this->getOffsetParent() !== null;
286            case "offsetTop":
287                return true;
288            case "offsetLeft":
289                return true;
290            case "offsetWidth":
291                return true;
292            case "offsetHeight":
293                return true;
294            default:
295                break;
296        }
297        return false;
298    }
299
300    /**
301     * @param string $name
302     * @param mixed $value
303     */
304    public function __set( string $name, $value ): void {
305        '@phan-var \Wikimedia\IDLeDOM\HTMLElement $this';
306        // @var \Wikimedia\IDLeDOM\HTMLElement $this
307        switch ( $name ) {
308            case "nodeValue":
309                $this->setNodeValue( $value );
310                return;
311            case "textContent":
312                $this->setTextContent( $value );
313                return;
314            case "innerHTML":
315                $this->setInnerHTML( $value );
316                return;
317            case "id":
318                $this->setId( $value );
319                return;
320            case "className":
321                $this->setClassName( $value );
322                return;
323            case "classList":
324                $this->setClassList( $value );
325                return;
326            case "slot":
327                $this->setSlot( $value );
328                return;
329            case "outerHTML":
330                $this->setOuterHTML( $value );
331                return;
332            case "style":
333                $this->setStyle( $value );
334                return;
335            case "contentEditable":
336                $this->setContentEditable( $value );
337                return;
338            case "enterKeyHint":
339                $this->setEnterKeyHint( $value );
340                return;
341            case "inputMode":
342                $this->setInputMode( $value );
343                return;
344            case "onload":
345                $this->setOnload( $value );
346                return;
347            case "nonce":
348                $this->setNonce( $value );
349                return;
350            case "tabIndex":
351                $this->setTabIndex( $value );
352                return;
353            case "title":
354                $this->setTitle( $value );
355                return;
356            case "lang":
357                $this->setLang( $value );
358                return;
359            case "translate":
360                $this->setTranslate( $value );
361                return;
362            case "dir":
363                $this->setDir( $value );
364                return;
365            case "hidden":
366                $this->setHidden( $value );
367                return;
368            case "accessKey":
369                $this->setAccessKey( $value );
370                return;
371            case "draggable":
372                $this->setDraggable( $value );
373                return;
374            case "spellcheck":
375                $this->setSpellcheck( $value );
376                return;
377            case "autocapitalize":
378                $this->setAutocapitalize( $value );
379                return;
380            case "innerText":
381                $this->setInnerText( $value );
382                return;
383            default:
384                break;
385        }
386        '@phan-var \Wikimedia\IDLeDOM\Helper\HTMLElement $this';
387        // @var \Wikimedia\IDLeDOM\Helper\HTMLElement $this
388        $this->_setMissingProp( $name, $value );
389    }
390
391    /**
392     * @param string $name
393     */
394    public function __unset( string $name ): void {
395        '@phan-var \Wikimedia\IDLeDOM\HTMLElement $this';
396        // @var \Wikimedia\IDLeDOM\HTMLElement $this
397        switch ( $name ) {
398            case "nodeType":
399                break;
400            case "nodeName":
401                break;
402            case "baseURI":
403                break;
404            case "isConnected":
405                break;
406            case "ownerDocument":
407                break;
408            case "parentNode":
409                break;
410            case "parentElement":
411                break;
412            case "childNodes":
413                break;
414            case "firstChild":
415                break;
416            case "lastChild":
417                break;
418            case "previousSibling":
419                break;
420            case "nextSibling":
421                break;
422            case "nodeValue":
423                $this->setNodeValue( null );
424                return;
425            case "textContent":
426                $this->setTextContent( null );
427                return;
428            case "innerHTML":
429                break;
430            case "previousElementSibling":
431                break;
432            case "nextElementSibling":
433                break;
434            case "children":
435                break;
436            case "firstElementChild":
437                break;
438            case "lastElementChild":
439                break;
440            case "childElementCount":
441                break;
442            case "assignedSlot":
443                break;
444            case "namespaceURI":
445                break;
446            case "prefix":
447                break;
448            case "localName":
449                break;
450            case "tagName":
451                break;
452            case "id":
453                break;
454            case "className":
455                break;
456            case "classList":
457                break;
458            case "slot":
459                break;
460            case "attributes":
461                break;
462            case "shadowRoot":
463                break;
464            case "outerHTML":
465                break;
466            case "style":
467                break;
468            case "contentEditable":
469                break;
470            case "enterKeyHint":
471                break;
472            case "isContentEditable":
473                break;
474            case "inputMode":
475                break;
476            case "onload":
477                break;
478            case "dataset":
479                break;
480            case "nonce":
481                break;
482            case "tabIndex":
483                break;
484            case "title":
485                break;
486            case "lang":
487                break;
488            case "translate":
489                break;
490            case "dir":
491                break;
492            case "hidden":
493                break;
494            case "accessKey":
495                break;
496            case "accessKeyLabel":
497                break;
498            case "draggable":
499                break;
500            case "spellcheck":
501                break;
502            case "autocapitalize":
503                break;
504            case "innerText":
505                break;
506            case "offsetParent":
507                break;
508            case "offsetTop":
509                break;
510            case "offsetLeft":
511                break;
512            case "offsetWidth":
513                break;
514            case "offsetHeight":
515                break;
516            default:
517                return;
518        }
519        $trace = debug_backtrace();
520        while (
521            count( $trace ) > 0 &&
522            $trace[0]['function'] !== "__unset"
523        ) {
524            array_shift( $trace );
525        }
526        trigger_error(
527            'Undefined property' .
528            ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
529            ' in ' . ( $trace[0]['file'] ?? '' ) .
530            ' on line ' . ( $trace[0]['line'] ?? '' ),
531            E_USER_NOTICE
532        );
533    }
534
535    /**
536     * @param string $val
537     */
538    public function setStyle( string $val ): void {
539        '@phan-var \Wikimedia\IDLeDOM\HTMLElement $this';
540        // @var \Wikimedia\IDLeDOM\HTMLElement $this
541        $this->getStyle()->setCssText( $val );
542    }
543
544    /**
545     * @return string
546     */
547    public function getEnterKeyHint(): string {
548        '@phan-var \Wikimedia\IDLeDOM\Element $this';
549        // @var \Wikimedia\IDLeDOM\Element $this
550        $val = $this->getAttribute( 'enterkeyhint' );
551        if ( $val !== null ) {
552            $val = strtr( $val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz' );
553            switch ( $val ) {
554                case 'enter':
555                case 'done':
556                case 'go':
557                case 'next':
558                case 'previous':
559                case 'search':
560                case 'send':
561                    return $val;
562                default:
563                    return '';
564            }
565        }
566        return '';
567    }
568
569    /**
570     * @param string $val
571     */
572    public function setEnterKeyHint( string $val ): void {
573        '@phan-var \Wikimedia\IDLeDOM\Element $this';
574        // @var \Wikimedia\IDLeDOM\Element $this
575        $this->setAttribute( 'enterkeyhint', $val );
576    }
577
578    /**
579     * @return string
580     */
581    public function getInputMode(): string {
582        '@phan-var \Wikimedia\IDLeDOM\Element $this';
583        // @var \Wikimedia\IDLeDOM\Element $this
584        $val = $this->getAttribute( 'inputmode' );
585        if ( $val !== null ) {
586            $val = strtr( $val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz' );
587            switch ( $val ) {
588                case 'none':
589                case 'text':
590                case 'tel':
591                case 'url':
592                case 'email':
593                case 'numeric':
594                case 'decimal':
595                case 'search':
596                    return $val;
597                default:
598                    return '';
599            }
600        }
601        return '';
602    }
603
604    /**
605     * @param string $val
606     */
607    public function setInputMode( string $val ): void {
608        '@phan-var \Wikimedia\IDLeDOM\Element $this';
609        // @var \Wikimedia\IDLeDOM\Element $this
610        $this->setAttribute( 'inputmode', $val );
611    }
612
613    /**
614     * @return string
615     */
616    public function getNonce(): string {
617        '@phan-var \Wikimedia\IDLeDOM\Element $this';
618        // @var \Wikimedia\IDLeDOM\Element $this
619        return $this->getAttribute( 'nonce' ) ?? '';
620    }
621
622    /**
623     * @param string $val
624     */
625    public function setNonce( string $val ): void {
626        '@phan-var \Wikimedia\IDLeDOM\Element $this';
627        // @var \Wikimedia\IDLeDOM\Element $this
628        $this->setAttribute( 'nonce', $val );
629    }
630
631    /**
632     * @return string
633     */
634    public function getTitle(): string {
635        '@phan-var \Wikimedia\IDLeDOM\Element $this';
636        // @var \Wikimedia\IDLeDOM\Element $this
637        return $this->getAttribute( 'title' ) ?? '';
638    }
639
640    /**
641     * @param string $val
642     */
643    public function setTitle( string $val ): void {
644        '@phan-var \Wikimedia\IDLeDOM\Element $this';
645        // @var \Wikimedia\IDLeDOM\Element $this
646        $this->setAttribute( 'title', $val );
647    }
648
649    /**
650     * @return string
651     */
652    public function getLang(): string {
653        '@phan-var \Wikimedia\IDLeDOM\Element $this';
654        // @var \Wikimedia\IDLeDOM\Element $this
655        return $this->getAttribute( 'lang' ) ?? '';
656    }
657
658    /**
659     * @param string $val
660     */
661    public function setLang( string $val ): void {
662        '@phan-var \Wikimedia\IDLeDOM\Element $this';
663        // @var \Wikimedia\IDLeDOM\Element $this
664        $this->setAttribute( 'lang', $val );
665    }
666
667    /**
668     * @return string
669     */
670    public function getDir(): string {
671        '@phan-var \Wikimedia\IDLeDOM\Element $this';
672        // @var \Wikimedia\IDLeDOM\Element $this
673        $val = $this->getAttribute( 'dir' );
674        if ( $val !== null ) {
675            $val = strtr( $val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz' );
676            switch ( $val ) {
677                case 'ltr':
678                case 'rtl':
679                case 'auto':
680                    return $val;
681                default:
682                    return '';
683            }
684        }
685        return '';
686    }
687
688    /**
689     * @param string $val
690     */
691    public function setDir( string $val ): void {
692        '@phan-var \Wikimedia\IDLeDOM\Element $this';
693        // @var \Wikimedia\IDLeDOM\Element $this
694        $this->setAttribute( 'dir', $val );
695    }
696
697    /**
698     * @return bool
699     */
700    public function getHidden(): bool {
701        '@phan-var \Wikimedia\IDLeDOM\Element $this';
702        // @var \Wikimedia\IDLeDOM\Element $this
703        return $this->hasAttribute( 'hidden' );
704    }
705
706    /**
707     * @param bool $val
708     */
709    public function setHidden( bool $val ): void {
710        '@phan-var \Wikimedia\IDLeDOM\Element $this';
711        // @var \Wikimedia\IDLeDOM\Element $this
712        if ( $val ) {
713            $this->setAttribute( 'hidden', '' );
714        } else {
715            $this->removeAttribute( 'hidden' );
716        }
717    }
718
719    /**
720     * @return string
721     */
722    public function getAccessKey(): string {
723        '@phan-var \Wikimedia\IDLeDOM\Element $this';
724        // @var \Wikimedia\IDLeDOM\Element $this
725        return $this->getAttribute( 'accesskey' ) ?? '';
726    }
727
728    /**
729     * @param string $val
730     */
731    public function setAccessKey( string $val ): void {
732        '@phan-var \Wikimedia\IDLeDOM\Element $this';
733        // @var \Wikimedia\IDLeDOM\Element $this
734        $this->setAttribute( 'accesskey', $val );
735    }
736
737}