Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 80 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
MutationObserverInit | |
0.00% |
0 / 80 |
|
0.00% |
0 / 9 |
1482 | |
0.00% |
0 / 1 |
_getMissingProp | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
12 | |||
_setMissingProp | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
12 | |||
__get | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
90 | |||
__isset | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
90 | |||
offsetExists | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
90 | |||
offsetGet | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
offsetSet | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
offsetUnset | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
cast | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | // AUTOMATICALLY GENERATED. DO NOT EDIT. |
4 | // Use `composer build` to regenerate. |
5 | |
6 | namespace Wikimedia\IDLeDOM\Helper; |
7 | |
8 | trait MutationObserverInit { |
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\MutationObserverInit $this'; |
75 | // @var \Wikimedia\IDLeDOM\MutationObserverInit $this |
76 | switch ( $name ) { |
77 | case "childList": |
78 | return $this->getChildList(); |
79 | case "attributes": |
80 | return $this->getAttributes(); |
81 | case "characterData": |
82 | return $this->getCharacterData(); |
83 | case "subtree": |
84 | return $this->getSubtree(); |
85 | case "attributeOldValue": |
86 | return $this->getAttributeOldValue(); |
87 | case "characterDataOldValue": |
88 | return $this->getCharacterDataOldValue(); |
89 | case "attributeFilter": |
90 | return $this->getAttributeFilter(); |
91 | default: |
92 | break; |
93 | } |
94 | '@phan-var \Wikimedia\IDLeDOM\Helper\MutationObserverInit $this'; |
95 | // @var \Wikimedia\IDLeDOM\Helper\MutationObserverInit $this |
96 | return $this->_getMissingProp( $name ); |
97 | } |
98 | |
99 | /** |
100 | * @param string $name |
101 | * @return bool |
102 | */ |
103 | public function __isset( string $name ): bool { |
104 | '@phan-var \Wikimedia\IDLeDOM\MutationObserverInit $this'; |
105 | // @var \Wikimedia\IDLeDOM\MutationObserverInit $this |
106 | switch ( $name ) { |
107 | case "childList": |
108 | return true; |
109 | case "attributes": |
110 | return true; |
111 | case "characterData": |
112 | return true; |
113 | case "subtree": |
114 | return true; |
115 | case "attributeOldValue": |
116 | return true; |
117 | case "characterDataOldValue": |
118 | return true; |
119 | case "attributeFilter": |
120 | return true; |
121 | default: |
122 | break; |
123 | } |
124 | return false; |
125 | } |
126 | |
127 | /** |
128 | * @param mixed $offset |
129 | * @return bool |
130 | */ |
131 | public function offsetExists( $offset ): bool { |
132 | switch ( $offset ) { |
133 | case "childList": |
134 | case "attributes": |
135 | case "characterData": |
136 | case "subtree": |
137 | case "attributeOldValue": |
138 | case "characterDataOldValue": |
139 | case "attributeFilter": |
140 | return true; |
141 | default: |
142 | break; |
143 | } |
144 | return false; |
145 | } |
146 | |
147 | /** |
148 | * @param mixed $offset |
149 | * @return mixed |
150 | */ |
151 | #[\ReturnTypeWillChange] |
152 | public function offsetGet( $offset ) { |
153 | return $this->$offset; |
154 | } |
155 | |
156 | /** |
157 | * @param mixed $offset |
158 | * @param mixed $value |
159 | */ |
160 | public function offsetSet( $offset, $value ): void { |
161 | $this->$offset = $value; |
162 | } |
163 | |
164 | /** |
165 | * @param mixed $offset |
166 | */ |
167 | public function offsetUnset( $offset ): void { |
168 | unset( $this->$offset ); |
169 | } |
170 | |
171 | /** |
172 | * Create a MutationObserverInit from an associative array. |
173 | * |
174 | * @param array|\Wikimedia\IDLeDOM\MutationObserverInit $a |
175 | * @return \Wikimedia\IDLeDOM\MutationObserverInit |
176 | */ |
177 | public static function cast( $a ) { |
178 | if ( $a instanceof \Wikimedia\IDLeDOM\MutationObserverInit ) { |
179 | return $a; |
180 | } |
181 | return new class( $a ) extends \Wikimedia\IDLeDOM\MutationObserverInit { |
182 | use MutationObserverInit; |
183 | |
184 | /** @var array */ |
185 | private $a; |
186 | |
187 | /** |
188 | * @param array $a |
189 | */ |
190 | public function __construct( $a ) { |
191 | $this->a = $a; |
192 | } |
193 | |
194 | /** |
195 | * @return bool |
196 | */ |
197 | public function getChildList(): bool { |
198 | return $this->a["childList"] ?? false; |
199 | } |
200 | |
201 | /** |
202 | * @return bool |
203 | */ |
204 | public function getAttributes(): bool { |
205 | return $this->a["attributes"]; |
206 | } |
207 | |
208 | /** |
209 | * @return bool |
210 | */ |
211 | public function getCharacterData(): bool { |
212 | return $this->a["characterData"]; |
213 | } |
214 | |
215 | /** |
216 | * @return bool |
217 | */ |
218 | public function getSubtree(): bool { |
219 | return $this->a["subtree"] ?? false; |
220 | } |
221 | |
222 | /** |
223 | * @return bool |
224 | */ |
225 | public function getAttributeOldValue(): bool { |
226 | return $this->a["attributeOldValue"]; |
227 | } |
228 | |
229 | /** |
230 | * @return bool |
231 | */ |
232 | public function getCharacterDataOldValue(): bool { |
233 | return $this->a["characterDataOldValue"]; |
234 | } |
235 | |
236 | /** |
237 | * @return list<string> |
238 | */ |
239 | public function getAttributeFilter(): array { |
240 | return $this->a["attributeFilter"]; |
241 | } |
242 | |
243 | }; |
244 | } |
245 | |
246 | } |