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