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