Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/ElementContentEditable.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 ElementContentEditable {
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 protected function _getMissingProp( string $prop ) {
24 $trace = debug_backtrace();
25 while (
26 count( $trace ) > 0 &&
27 $trace[0]['function'] !== "__get"
28 ) {
29 array_shift( $trace );
30 }
31 trigger_error(
32 'Undefined property' .
33 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop .
34 ' in ' . ( $trace[0]['file'] ?? '' ) .
35 ' on line ' . ( $trace[0]['line'] ?? '' ),
36 E_USER_NOTICE
37 );
38 return null;
39 }
40
41 /**
42 * Handle an attempt to set a non-existing property on this
43 * object. The default implementation raises an exception
44 * but the implementor can choose a different behavior:
45 * ignore the operation (like JavaScript), dynamically create
46 * the property, etc.
47 * @param string $prop the name of the property requested
48 * @param mixed $value the value to set
49 */
50 protected function _setMissingProp( string $prop, $value ): void {
51 $trace = debug_backtrace();
52 while (
53 count( $trace ) > 0 &&
54 $trace[0]['function'] !== "__set"
55 ) {
56 array_shift( $trace );
57 }
58 trigger_error(
59 'Undefined property' .
60 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop .
61 ' in ' . ( $trace[0]['file'] ?? '' ) .
62 ' on line ' . ( $trace[0]['line'] ?? '' ),
63 E_USER_NOTICE
64 );
65 }
66
67 // phpcs:enable
68
69 /**
70 * @return string
71 */
72 public function getEnterKeyHint(): string {
73 '@phan-var \Wikimedia\IDLeDOM\Element $this';
74 // @var \Wikimedia\IDLeDOM\Element $this
75 $val = $this->getAttribute( 'enterkeyhint' );
76 if ( $val !== null ) {
77 $val = strtr( $val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz' );
78 switch ( $val ) {
79 case 'enter':
80 case 'done':
81 case 'go':
82 case 'next':
83 case 'previous':
84 case 'search':
85 case 'send':
86 return $val;
87 default:
88 return '';
89 }
90 }
91 return '';
92 }
93
94 /**
95 * @param string $val
96 */
97 public function setEnterKeyHint( string $val ): void {
98 '@phan-var \Wikimedia\IDLeDOM\Element $this';
99 // @var \Wikimedia\IDLeDOM\Element $this
100 $this->setAttribute( 'enterkeyhint', $val );
101 }
102
103 /**
104 * @return string
105 */
106 public function getInputMode(): string {
107 '@phan-var \Wikimedia\IDLeDOM\Element $this';
108 // @var \Wikimedia\IDLeDOM\Element $this
109 $val = $this->getAttribute( 'inputmode' );
110 if ( $val !== null ) {
111 $val = strtr( $val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz' );
112 switch ( $val ) {
113 case 'none':
114 case 'text':
115 case 'tel':
116 case 'url':
117 case 'email':
118 case 'numeric':
119 case 'decimal':
120 case 'search':
121 return $val;
122 default:
123 return '';
124 }
125 }
126 return '';
127 }
128
129 /**
130 * @param string $val
131 */
132 public function setInputMode( string $val ): void {
133 '@phan-var \Wikimedia\IDLeDOM\Element $this';
134 // @var \Wikimedia\IDLeDOM\Element $this
135 $this->setAttribute( 'inputmode', $val );
136 }
137
138 }