Debian Codegraph @

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