Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/Event.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 Event {
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 * @param string $name
71 * @return mixed
72 */
73 public function __get( string $name ) {
74 '@phan-var \Wikimedia\IDLeDOM\Event $this';
75 // @var \Wikimedia\IDLeDOM\Event $this
76 switch ( $name ) {
77 case "type":
78 return $this->getType();
79 case "target":
80 return $this->getTarget();
81 case "srcElement":
82 return $this->getSrcElement();
83 case "currentTarget":
84 return $this->getCurrentTarget();
85 case "eventPhase":
86 return $this->getEventPhase();
87 case "cancelBubble":
88 return $this->getCancelBubble();
89 case "bubbles":
90 return $this->getBubbles();
91 case "cancelable":
92 return $this->getCancelable();
93 case "returnValue":
94 return $this->getReturnValue();
95 case "defaultPrevented":
96 return $this->getDefaultPrevented();
97 case "composed":
98 return $this->getComposed();
99 case "isTrusted":
100 return $this->getIsTrusted();
101 case "timeStamp":
102 return $this->getTimeStamp();
103 default:
104 break;
105 }
106 '@phan-var \Wikimedia\IDLeDOM\Helper\Event $this';
107 // @var \Wikimedia\IDLeDOM\Helper\Event $this
108 return $this->_getMissingProp( $name );
109 }
110
111 /**
112 * @param string $name
113 * @return bool
114 */
115 public function __isset( string $name ): bool {
116 '@phan-var \Wikimedia\IDLeDOM\Event $this';
117 // @var \Wikimedia\IDLeDOM\Event $this
118 switch ( $name ) {
119 case "type":
120 return true;
121 case "target":
122 return $this->getTarget() !== null;
123 case "srcElement":
124 return $this->getSrcElement() !== null;
125 case "currentTarget":
126 return $this->getCurrentTarget() !== null;
127 case "eventPhase":
128 return true;
129 case "cancelBubble":
130 return true;
131 case "bubbles":
132 return true;
133 case "cancelable":
134 return true;
135 case "returnValue":
136 return true;
137 case "defaultPrevented":
138 return true;
139 case "composed":
140 return true;
141 case "isTrusted":
142 return true;
143 case "timeStamp":
144 return true;
145 default:
146 break;
147 }
148 return false;
149 }
150
151 /**
152 * @param string $name
153 * @param mixed $value
154 */
155 public function __set( string $name, $value ): void {
156 '@phan-var \Wikimedia\IDLeDOM\Event $this';
157 // @var \Wikimedia\IDLeDOM\Event $this
158 switch ( $name ) {
159 case "cancelBubble":
160 $this->setCancelBubble( $value );
161 return;
162 case "returnValue":
163 $this->setReturnValue( $value );
164 return;
165 default:
166 break;
167 }
168 '@phan-var \Wikimedia\IDLeDOM\Helper\Event $this';
169 // @var \Wikimedia\IDLeDOM\Helper\Event $this
170 $this->_setMissingProp( $name, $value );
171 }
172
173 /**
174 * @param string $name
175 */
176 public function __unset( string $name ): void {
177 '@phan-var \Wikimedia\IDLeDOM\Event $this';
178 // @var \Wikimedia\IDLeDOM\Event $this
179 switch ( $name ) {
180 case "type":
181 break;
182 case "target":
183 break;
184 case "srcElement":
185 break;
186 case "currentTarget":
187 break;
188 case "eventPhase":
189 break;
190 case "cancelBubble":
191 break;
192 case "bubbles":
193 break;
194 case "cancelable":
195 break;
196 case "returnValue":
197 break;
198 case "defaultPrevented":
199 break;
200 case "composed":
201 break;
202 case "isTrusted":
203 break;
204 case "timeStamp":
205 break;
206 default:
207 return;
208 }
209 $trace = debug_backtrace();
210 while (
211 count( $trace ) > 0 &&
212 $trace[0]['function'] !== "__unset"
213 ) {
214 array_shift( $trace );
215 }
216 trigger_error(
217 'Undefined property' .
218 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
219 ' in ' . ( $trace[0]['file'] ?? '' ) .
220 ' on line ' . ( $trace[0]['line'] ?? '' ),
221 E_USER_NOTICE
222 );
223 }
224
225 }