Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 105 |
|
0.00% |
0 / 11 |
CRAP | |
0.00% |
0 / 1 |
MediaList | |
0.00% |
0 / 105 |
|
0.00% |
0 / 11 |
1980 | |
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 / 6 |
|
0.00% |
0 / 1 |
20 | |||
__isset | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
20 | |||
__set | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
12 | |||
__unset | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
42 | |||
__toString | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
offsetExists | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
offsetGet | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
90 | |||
offsetSet | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
30 | |||
offsetUnset | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
30 |
1 | <?php |
2 | |
3 | // AUTOMATICALLY GENERATED. DO NOT EDIT. |
4 | // Use `composer build` to regenerate. |
5 | |
6 | namespace Wikimedia\IDLeDOM\Helper; |
7 | |
8 | trait MediaList { |
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\MediaList $this'; |
75 | // @var \Wikimedia\IDLeDOM\MediaList $this |
76 | switch ( $name ) { |
77 | case "mediaText": |
78 | return $this->getMediaText(); |
79 | case "length": |
80 | return $this->getLength(); |
81 | default: |
82 | break; |
83 | } |
84 | '@phan-var \Wikimedia\IDLeDOM\Helper\MediaList $this'; |
85 | // @var \Wikimedia\IDLeDOM\Helper\MediaList $this |
86 | return $this->_getMissingProp( $name ); |
87 | } |
88 | |
89 | /** |
90 | * @param string $name |
91 | * @return bool |
92 | */ |
93 | public function __isset( string $name ): bool { |
94 | '@phan-var \Wikimedia\IDLeDOM\MediaList $this'; |
95 | // @var \Wikimedia\IDLeDOM\MediaList $this |
96 | switch ( $name ) { |
97 | case "mediaText": |
98 | return true; |
99 | case "length": |
100 | return true; |
101 | default: |
102 | break; |
103 | } |
104 | return false; |
105 | } |
106 | |
107 | /** |
108 | * @param string $name |
109 | * @param mixed $value |
110 | */ |
111 | public function __set( string $name, $value ): void { |
112 | '@phan-var \Wikimedia\IDLeDOM\MediaList $this'; |
113 | // @var \Wikimedia\IDLeDOM\MediaList $this |
114 | switch ( $name ) { |
115 | case "mediaText": |
116 | $this->setMediaText( $value ); |
117 | return; |
118 | default: |
119 | break; |
120 | } |
121 | '@phan-var \Wikimedia\IDLeDOM\Helper\MediaList $this'; |
122 | // @var \Wikimedia\IDLeDOM\Helper\MediaList $this |
123 | $this->_setMissingProp( $name, $value ); |
124 | } |
125 | |
126 | /** |
127 | * @param string $name |
128 | */ |
129 | public function __unset( string $name ): void { |
130 | '@phan-var \Wikimedia\IDLeDOM\MediaList $this'; |
131 | // @var \Wikimedia\IDLeDOM\MediaList $this |
132 | switch ( $name ) { |
133 | case "mediaText": |
134 | break; |
135 | case "length": |
136 | break; |
137 | default: |
138 | return; |
139 | } |
140 | $trace = debug_backtrace(); |
141 | while ( |
142 | count( $trace ) > 0 && |
143 | $trace[0]['function'] !== "__unset" |
144 | ) { |
145 | array_shift( $trace ); |
146 | } |
147 | trigger_error( |
148 | 'Undefined property' . |
149 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name . |
150 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
151 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
152 | E_USER_NOTICE |
153 | ); |
154 | } |
155 | |
156 | /** |
157 | * @return string |
158 | */ |
159 | public function __toString(): string { |
160 | '@phan-var \Wikimedia\IDLeDOM\MediaList $this'; |
161 | // @var \Wikimedia\IDLeDOM\MediaList $this |
162 | return $this->getMediaText(); |
163 | } |
164 | |
165 | /** |
166 | * @param mixed $offset |
167 | * @return bool |
168 | */ |
169 | public function offsetExists( $offset ): bool { |
170 | return $this->offsetGet( $offset ) !== null; |
171 | } |
172 | |
173 | /** |
174 | * @param mixed $offset |
175 | * @return mixed |
176 | */ |
177 | #[\ReturnTypeWillChange] |
178 | public function offsetGet( $offset ) { |
179 | '@phan-var \Wikimedia\IDLeDOM\MediaList $this'; |
180 | // @var \Wikimedia\IDLeDOM\MediaList $this |
181 | if ( is_numeric( $offset ) ) { |
182 | return $this->item( $offset ); |
183 | } elseif ( is_string( $offset ) ) { |
184 | /* Fall through */ |
185 | } |
186 | $trace = debug_backtrace(); |
187 | while ( |
188 | count( $trace ) > 0 && |
189 | $trace[0]['function'] !== "offsetGet" && |
190 | $trace[0]['function'] !== "offsetExists" |
191 | ) { |
192 | array_shift( $trace ); |
193 | } |
194 | while ( |
195 | count( $trace ) > 1 && ( |
196 | $trace[1]['function'] === "offsetGet" || |
197 | $trace[1]['function'] === "offsetExists" |
198 | ) ) { |
199 | array_shift( $trace ); |
200 | } |
201 | trigger_error( |
202 | 'Undefined property' . |
203 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
204 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
205 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
206 | E_USER_NOTICE |
207 | ); |
208 | return null; |
209 | } |
210 | |
211 | /** |
212 | * @param mixed $offset |
213 | * @param mixed $value |
214 | */ |
215 | public function offsetSet( $offset, $value ): void { |
216 | '@phan-var \Wikimedia\IDLeDOM\MediaList $this'; |
217 | // @var \Wikimedia\IDLeDOM\MediaList $this |
218 | if ( is_numeric( $offset ) ) { |
219 | /* Fall through */ |
220 | } elseif ( is_string( $offset ) ) { |
221 | /* Fall through */ |
222 | } |
223 | $trace = debug_backtrace(); |
224 | while ( |
225 | count( $trace ) > 0 && |
226 | $trace[0]['function'] !== "offsetSet" |
227 | ) { |
228 | array_shift( $trace ); |
229 | } |
230 | trigger_error( |
231 | 'Undefined property' . |
232 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
233 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
234 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
235 | E_USER_NOTICE |
236 | ); |
237 | } |
238 | |
239 | /** |
240 | * @param mixed $offset |
241 | */ |
242 | public function offsetUnset( $offset ): void { |
243 | '@phan-var \Wikimedia\IDLeDOM\MediaList $this'; |
244 | // @var \Wikimedia\IDLeDOM\MediaList $this |
245 | if ( is_numeric( $offset ) ) { |
246 | /* Fall through */ |
247 | } elseif ( is_string( $offset ) ) { |
248 | /* Fall through */ |
249 | } |
250 | $trace = debug_backtrace(); |
251 | while ( |
252 | count( $trace ) > 0 && |
253 | $trace[0]['function'] !== "offsetUnset" |
254 | ) { |
255 | array_shift( $trace ); |
256 | } |
257 | trigger_error( |
258 | 'Undefined property' . |
259 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
260 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
261 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
262 | E_USER_NOTICE |
263 | ); |
264 | } |
265 | |
266 | } |