Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/HTMLSelectElement.php

raw
1 <?php
2
3 // AUTOMATICALLY GENERATED. DO NOT EDIT.
4 // Use `composer build` to regenerate.
5
6 namespace Wikimedia\IDLeDOM\Helper;
7
8 trait HTMLSelectElement {
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\HTMLSelectElement $this';
44 // @var \Wikimedia\IDLeDOM\HTMLSelectElement $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 "autocomplete":
163 return $this->getAutocomplete();
164 case "autofocus":
165 return $this->getAutofocus();
166 case "disabled":
167 return $this->getDisabled();
168 case "form":
169 return $this->getForm();
170 case "multiple":
171 return $this->getMultiple();
172 case "name":
173 return $this->getName();
174 case "required":
175 return $this->getRequired();
176 case "size":
177 return $this->getSize();
178 case "type":
179 return $this->getType();
180 case "options":
181 return $this->getOptions();
182 case "length":
183 return $this->getLength();
184 case "selectedOptions":
185 return $this->getSelectedOptions();
186 case "selectedIndex":
187 return $this->getSelectedIndex();
188 case "value":
189 return $this->getValue();
190 case "willValidate":
191 return $this->getWillValidate();
192 case "validity":
193 return $this->getValidity();
194 case "validationMessage":
195 return $this->getValidationMessage();
196 case "labels":
197 return $this->getLabels();
198 default:
199 break;
200 }
201 '@phan-var \Wikimedia\IDLeDOM\Helper\HTMLSelectElement $this';
202 // @var \Wikimedia\IDLeDOM\Helper\HTMLSelectElement $this
203 return $this->_getMissingProp( $name );
204 }
205
206 /**
207 * @param string $name
208 * @return bool
209 */
210 public function __isset( string $name ): bool {
211 '@phan-var \Wikimedia\IDLeDOM\HTMLSelectElement $this';
212 // @var \Wikimedia\IDLeDOM\HTMLSelectElement $this
213 switch ( $name ) {
214 case "nodeType":
215 return true;
216 case "nodeName":
217 return true;
218 case "baseURI":
219 return true;
220 case "isConnected":
221 return true;
222 case "ownerDocument":
223 return $this->getOwnerDocument() !== null;
224 case "parentNode":
225 return $this->getParentNode() !== null;
226 case "parentElement":
227 return $this->getParentElement() !== null;
228 case "childNodes":
229 return true;
230 case "firstChild":
231 return $this->getFirstChild() !== null;
232 case "lastChild":
233 return $this->getLastChild() !== null;
234 case "previousSibling":
235 return $this->getPreviousSibling() !== null;
236 case "nextSibling":
237 return $this->getNextSibling() !== null;
238 case "nodeValue":
239 return $this->getNodeValue() !== null;
240 case "textContent":
241 return $this->getTextContent() !== null;
242 case "innerHTML":
243 return true;
244 case "previousElementSibling":
245 return $this->getPreviousElementSibling() !== null;
246 case "nextElementSibling":
247 return $this->getNextElementSibling() !== null;
248 case "children":
249 return true;
250 case "firstElementChild":
251 return $this->getFirstElementChild() !== null;
252 case "lastElementChild":
253 return $this->getLastElementChild() !== null;
254 case "childElementCount":
255 return true;
256 case "assignedSlot":
257 return $this->getAssignedSlot() !== null;
258 case "namespaceURI":
259 return $this->getNamespaceURI() !== null;
260 case "prefix":
261 return $this->getPrefix() !== null;
262 case "localName":
263 return true;
264 case "tagName":
265 return true;
266 case "id":
267 return true;
268 case "className":
269 return true;
270 case "classList":
271 return true;
272 case "slot":
273 return true;
274 case "attributes":
275 return true;
276 case "shadowRoot":
277 return $this->getShadowRoot() !== null;
278 case "outerHTML":
279 return true;
280 case "style":
281 return true;
282 case "contentEditable":
283 return true;
284 case "enterKeyHint":
285 return true;
286 case "isContentEditable":
287 return true;
288 case "inputMode":
289 return true;
290 case "onload":
291 return true;
292 case "dataset":
293 return true;
294 case "nonce":
295 return true;
296 case "tabIndex":
297 return true;
298 case "title":
299 return true;
300 case "lang":
301 return true;
302 case "translate":
303 return true;
304 case "dir":
305 return true;
306 case "hidden":
307 return true;
308 case "accessKey":
309 return true;
310 case "accessKeyLabel":
311 return true;
312 case "draggable":
313 return true;
314 case "spellcheck":
315 return true;
316 case "autocapitalize":
317 return true;
318 case "innerText":
319 return true;
320 case "offsetParent":
321 return $this->getOffsetParent() !== null;
322 case "offsetTop":
323 return true;
324 case "offsetLeft":
325 return true;
326 case "offsetWidth":
327 return true;
328 case "offsetHeight":
329 return true;
330 case "autocomplete":
331 return true;
332 case "autofocus":
333 return true;
334 case "disabled":
335 return true;
336 case "form":
337 return $this->getForm() !== null;
338 case "multiple":
339 return true;
340 case "name":
341 return true;
342 case "required":
343 return true;
344 case "size":
345 return true;
346 case "type":
347 return true;
348 case "options":
349 return true;
350 case "length":
351 return true;
352 case "selectedOptions":
353 return true;
354 case "selectedIndex":
355 return true;
356 case "value":
357 return true;
358 case "willValidate":
359 return true;
360 case "validity":
361 return true;
362 case "validationMessage":
363 return true;
364 case "labels":
365 return true;
366 default:
367 break;
368 }
369 return false;
370 }
371
372 /**
373 * @param string $name
374 * @param mixed $value
375 */
376 public function __set( string $name, $value ): void {
377 '@phan-var \Wikimedia\IDLeDOM\HTMLSelectElement $this';
378 // @var \Wikimedia\IDLeDOM\HTMLSelectElement $this
379 switch ( $name ) {
380 case "nodeValue":
381 $this->setNodeValue( $value );
382 return;
383 case "textContent":
384 $this->setTextContent( $value );
385 return;
386 case "innerHTML":
387 $this->setInnerHTML( $value );
388 return;
389 case "id":
390 $this->setId( $value );
391 return;
392 case "className":
393 $this->setClassName( $value );
394 return;
395 case "classList":
396 $this->setClassList( $value );
397 return;
398 case "slot":
399 $this->setSlot( $value );
400 return;
401 case "outerHTML":
402 $this->setOuterHTML( $value );
403 return;
404 case "style":
405 $this->setStyle( $value );
406 return;
407 case "contentEditable":
408 $this->setContentEditable( $value );
409 return;
410 case "enterKeyHint":
411 $this->setEnterKeyHint( $value );
412 return;
413 case "inputMode":
414 $this->setInputMode( $value );
415 return;
416 case "onload":
417 $this->setOnload( $value );
418 return;
419 case "nonce":
420 $this->setNonce( $value );
421 return;
422 case "tabIndex":
423 $this->setTabIndex( $value );
424 return;
425 case "title":
426 $this->setTitle( $value );
427 return;
428 case "lang":
429 $this->setLang( $value );
430 return;
431 case "translate":
432 $this->setTranslate( $value );
433 return;
434 case "dir":
435 $this->setDir( $value );
436 return;
437 case "hidden":
438 $this->setHidden( $value );
439 return;
440 case "accessKey":
441 $this->setAccessKey( $value );
442 return;
443 case "draggable":
444 $this->setDraggable( $value );
445 return;
446 case "spellcheck":
447 $this->setSpellcheck( $value );
448 return;
449 case "autocapitalize":
450 $this->setAutocapitalize( $value );
451 return;
452 case "innerText":
453 $this->setInnerText( $value );
454 return;
455 case "autocomplete":
456 $this->setAutocomplete( $value );
457 return;
458 case "autofocus":
459 $this->setAutofocus( $value );
460 return;
461 case "disabled":
462 $this->setDisabled( $value );
463 return;
464 case "multiple":
465 $this->setMultiple( $value );
466 return;
467 case "name":
468 $this->setName( $value );
469 return;
470 case "required":
471 $this->setRequired( $value );
472 return;
473 case "size":
474 $this->setSize( $value );
475 return;
476 case "length":
477 $this->setLength( $value );
478 return;
479 case "selectedIndex":
480 $this->setSelectedIndex( $value );
481 return;
482 case "value":
483 $this->setValue( $value );
484 return;
485 default:
486 break;
487 }
488 '@phan-var \Wikimedia\IDLeDOM\Helper\HTMLSelectElement $this';
489 // @var \Wikimedia\IDLeDOM\Helper\HTMLSelectElement $this
490 $this->_setMissingProp( $name, $value );
491 }
492
493 /**
494 * @param string $name
495 */
496 public function __unset( string $name ): void {
497 '@phan-var \Wikimedia\IDLeDOM\HTMLSelectElement $this';
498 // @var \Wikimedia\IDLeDOM\HTMLSelectElement $this
499 switch ( $name ) {
500 case "nodeType":
501 break;
502 case "nodeName":
503 break;
504 case "baseURI":
505 break;
506 case "isConnected":
507 break;
508 case "ownerDocument":
509 break;
510 case "parentNode":
511 break;
512 case "parentElement":
513 break;
514 case "childNodes":
515 break;
516 case "firstChild":
517 break;
518 case "lastChild":
519 break;
520 case "previousSibling":
521 break;
522 case "nextSibling":
523 break;
524 case "nodeValue":
525 $this->setNodeValue( null );
526 return;
527 case "textContent":
528 $this->setTextContent( null );
529 return;
530 case "innerHTML":
531 break;
532 case "previousElementSibling":
533 break;
534 case "nextElementSibling":
535 break;
536 case "children":
537 break;
538 case "firstElementChild":
539 break;
540 case "lastElementChild":
541 break;
542 case "childElementCount":
543 break;
544 case "assignedSlot":
545 break;
546 case "namespaceURI":
547 break;
548 case "prefix":
549 break;
550 case "localName":
551 break;
552 case "tagName":
553 break;
554 case "id":
555 break;
556 case "className":
557 break;
558 case "classList":
559 break;
560 case "slot":
561 break;
562 case "attributes":
563 break;
564 case "shadowRoot":
565 break;
566 case "outerHTML":
567 break;
568 case "style":
569 break;
570 case "contentEditable":
571 break;
572 case "enterKeyHint":
573 break;
574 case "isContentEditable":
575 break;
576 case "inputMode":
577 break;
578 case "onload":
579 break;
580 case "dataset":
581 break;
582 case "nonce":
583 break;
584 case "tabIndex":
585 break;
586 case "title":
587 break;
588 case "lang":
589 break;
590 case "translate":
591 break;
592 case "dir":
593 break;
594 case "hidden":
595 break;
596 case "accessKey":
597 break;
598 case "accessKeyLabel":
599 break;
600 case "draggable":
601 break;
602 case "spellcheck":
603 break;
604 case "autocapitalize":
605 break;
606 case "innerText":
607 break;
608 case "offsetParent":
609 break;
610 case "offsetTop":
611 break;
612 case "offsetLeft":
613 break;
614 case "offsetWidth":
615 break;
616 case "offsetHeight":
617 break;
618 case "autocomplete":
619 break;
620 case "autofocus":
621 break;
622 case "disabled":
623 break;
624 case "form":
625 break;
626 case "multiple":
627 break;
628 case "name":
629 break;
630 case "required":
631 break;
632 case "size":
633 break;
634 case "type":
635 break;
636 case "options":
637 break;
638 case "length":
639 break;
640 case "selectedOptions":
641 break;
642 case "selectedIndex":
643 break;
644 case "value":
645 break;
646 case "willValidate":
647 break;
648 case "validity":
649 break;
650 case "validationMessage":
651 break;
652 case "labels":
653 break;
654 default:
655 return;
656 }
657 $trace = debug_backtrace();
658 while (
659 count( $trace ) > 0 &&
660 $trace[0]['function'] !== "__unset"
661 ) {
662 array_shift( $trace );
663 }
664 trigger_error(
665 'Undefined property' .
666 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
667 ' in ' . ( $trace[0]['file'] ?? '' ) .
668 ' on line ' . ( $trace[0]['line'] ?? '' ),
669 E_USER_NOTICE
670 );
671 }
672
673 /**
674 * @return string
675 */
676 public function getAutocomplete(): string {
677 '@phan-var \Wikimedia\IDLeDOM\Element $this';
678 // @var \Wikimedia\IDLeDOM\Element $this
679 $val = $this->getAttribute( 'autocomplete' );
680 if ( $val !== null ) {
681 $val = strtr( $val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz' );
682 switch ( $val ) {
683 case 'on':
684 case 'off':
685 return $val;
686 default:
687 return 'on';
688 }
689 }
690 return 'on';
691 }
692
693 /**
694 * @param string $val
695 */
696 public function setAutocomplete( string $val ): void {
697 '@phan-var \Wikimedia\IDLeDOM\Element $this';
698 // @var \Wikimedia\IDLeDOM\Element $this
699 $this->setAttribute( 'autocomplete', $val );
700 }
701
702 /**
703 * @return bool
704 */
705 public function getAutofocus(): bool {
706 '@phan-var \Wikimedia\IDLeDOM\Element $this';
707 // @var \Wikimedia\IDLeDOM\Element $this
708 return $this->hasAttribute( 'autofocus' );
709 }
710
711 /**
712 * @param bool $val
713 */
714 public function setAutofocus( bool $val ): void {
715 '@phan-var \Wikimedia\IDLeDOM\Element $this';
716 // @var \Wikimedia\IDLeDOM\Element $this
717 if ( $val ) {
718 $this->setAttribute( 'autofocus', '' );
719 } else {
720 $this->removeAttribute( 'autofocus' );
721 }
722 }
723
724 /**
725 * @return bool
726 */
727 public function getDisabled(): bool {
728 '@phan-var \Wikimedia\IDLeDOM\Element $this';
729 // @var \Wikimedia\IDLeDOM\Element $this
730 return $this->hasAttribute( 'disabled' );
731 }
732
733 /**
734 * @param bool $val
735 */
736 public function setDisabled( bool $val ): void {
737 '@phan-var \Wikimedia\IDLeDOM\Element $this';
738 // @var \Wikimedia\IDLeDOM\Element $this
739 if ( $val ) {
740 $this->setAttribute( 'disabled', '' );
741 } else {
742 $this->removeAttribute( 'disabled' );
743 }
744 }
745
746 /**
747 * @return bool
748 */
749 public function getMultiple(): bool {
750 '@phan-var \Wikimedia\IDLeDOM\Element $this';
751 // @var \Wikimedia\IDLeDOM\Element $this
752 return $this->hasAttribute( 'multiple' );
753 }
754
755 /**
756 * @param bool $val
757 */
758 public function setMultiple( bool $val ): void {
759 '@phan-var \Wikimedia\IDLeDOM\Element $this';
760 // @var \Wikimedia\IDLeDOM\Element $this
761 if ( $val ) {
762 $this->setAttribute( 'multiple', '' );
763 } else {
764 $this->removeAttribute( 'multiple' );
765 }
766 }
767
768 /**
769 * @return string
770 */
771 public function getName(): string {
772 '@phan-var \Wikimedia\IDLeDOM\Element $this';
773 // @var \Wikimedia\IDLeDOM\Element $this
774 return $this->getAttribute( 'name' ) ?? '';
775 }
776
777 /**
778 * @param string $val
779 */
780 public function setName( string $val ): void {
781 '@phan-var \Wikimedia\IDLeDOM\Element $this';
782 // @var \Wikimedia\IDLeDOM\Element $this
783 $this->setAttribute( 'name', $val );
784 }
785
786 /**
787 * @return bool
788 */
789 public function getRequired(): bool {
790 '@phan-var \Wikimedia\IDLeDOM\Element $this';
791 // @var \Wikimedia\IDLeDOM\Element $this
792 return $this->hasAttribute( 'required' );
793 }
794
795 /**
796 * @param bool $val
797 */
798 public function setRequired( bool $val ): void {
799 '@phan-var \Wikimedia\IDLeDOM\Element $this';
800 // @var \Wikimedia\IDLeDOM\Element $this
801 if ( $val ) {
802 $this->setAttribute( 'required', '' );
803 } else {
804 $this->removeAttribute( 'required' );
805 }
806 }
807
808 /**
809 * @param mixed $offset
810 * @return bool
811 */
812 public function offsetExists( $offset ): bool {
813 return $this->offsetGet( $offset ) !== null;
814 }
815
816 /**
817 * @param mixed $offset
818 * @return mixed
819 */
820 #[\ReturnTypeWillChange]
821 public function offsetGet( $offset ) {
822 '@phan-var \Wikimedia\IDLeDOM\HTMLSelectElement $this';
823 // @var \Wikimedia\IDLeDOM\HTMLSelectElement $this
824 if ( is_numeric( $offset ) ) {
825 return $this->item( $offset );
826 } elseif ( is_string( $offset ) ) {
827 /* Fall through */
828 }
829 $trace = debug_backtrace();
830 while (
831 count( $trace ) > 0 &&
832 $trace[0]['function'] !== "offsetGet" &&
833 $trace[0]['function'] !== "offsetExists"
834 ) {
835 array_shift( $trace );
836 }
837 while (
838 count( $trace ) > 1 && (
839 $trace[1]['function'] === "offsetGet" ||
840 $trace[1]['function'] === "offsetExists"
841 ) ) {
842 array_shift( $trace );
843 }
844 trigger_error(
845 'Undefined property' .
846 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
847 ' in ' . ( $trace[0]['file'] ?? '' ) .
848 ' on line ' . ( $trace[0]['line'] ?? '' ),
849 E_USER_NOTICE
850 );
851 return null;
852 }
853
854 /**
855 * @param mixed $offset
856 * @param mixed $value
857 */
858 public function offsetSet( $offset, $value ): void {
859 '@phan-var \Wikimedia\IDLeDOM\HTMLSelectElement $this';
860 // @var \Wikimedia\IDLeDOM\HTMLSelectElement $this
861 if ( is_numeric( $offset ) ) {
862 $this->setItem( $offset, $value );
863 } elseif ( is_string( $offset ) ) {
864 /* Fall through */
865 }
866 $trace = debug_backtrace();
867 while (
868 count( $trace ) > 0 &&
869 $trace[0]['function'] !== "offsetSet"
870 ) {
871 array_shift( $trace );
872 }
873 trigger_error(
874 'Undefined property' .
875 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
876 ' in ' . ( $trace[0]['file'] ?? '' ) .
877 ' on line ' . ( $trace[0]['line'] ?? '' ),
878 E_USER_NOTICE
879 );
880 }
881
882 /**
883 * @param mixed $offset
884 */
885 public function offsetUnset( $offset ): void {
886 '@phan-var \Wikimedia\IDLeDOM\HTMLSelectElement $this';
887 // @var \Wikimedia\IDLeDOM\HTMLSelectElement $this
888 if ( is_numeric( $offset ) ) {
889 /* Fall through */
890 } elseif ( is_string( $offset ) ) {
891 /* Fall through */
892 }
893 $trace = debug_backtrace();
894 while (
895 count( $trace ) > 0 &&
896 $trace[0]['function'] !== "offsetUnset"
897 ) {
898 array_shift( $trace );
899 }
900 trigger_error(
901 'Undefined property' .
902 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
903 ' in ' . ( $trace[0]['file'] ?? '' ) .
904 ' on line ' . ( $trace[0]['line'] ?? '' ),
905 E_USER_NOTICE
906 );
907 }
908
909 }