Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/TextTrackList.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 TextTrackList {
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\TextTrackList $this';
44 // @var \Wikimedia\IDLeDOM\TextTrackList $this
45 switch ( $name ) {
46 case "length":
47 return $this->getLength();
48 case "onchange":
49 return $this->getOnchange();
50 case "onaddtrack":
51 return $this->getOnaddtrack();
52 case "onremovetrack":
53 return $this->getOnremovetrack();
54 default:
55 break;
56 }
57 '@phan-var \Wikimedia\IDLeDOM\Helper\TextTrackList $this';
58 // @var \Wikimedia\IDLeDOM\Helper\TextTrackList $this
59 return $this->_getMissingProp( $name );
60 }
61
62 /**
63 * @param string $name
64 * @return bool
65 */
66 public function __isset( string $name ): bool {
67 '@phan-var \Wikimedia\IDLeDOM\TextTrackList $this';
68 // @var \Wikimedia\IDLeDOM\TextTrackList $this
69 switch ( $name ) {
70 case "length":
71 return true;
72 case "onchange":
73 return true;
74 case "onaddtrack":
75 return true;
76 case "onremovetrack":
77 return true;
78 default:
79 break;
80 }
81 return false;
82 }
83
84 /**
85 * @param string $name
86 * @param mixed $value
87 */
88 public function __set( string $name, $value ): void {
89 '@phan-var \Wikimedia\IDLeDOM\TextTrackList $this';
90 // @var \Wikimedia\IDLeDOM\TextTrackList $this
91 switch ( $name ) {
92 case "onchange":
93 $this->setOnchange( $value );
94 return;
95 case "onaddtrack":
96 $this->setOnaddtrack( $value );
97 return;
98 case "onremovetrack":
99 $this->setOnremovetrack( $value );
100 return;
101 default:
102 break;
103 }
104 '@phan-var \Wikimedia\IDLeDOM\Helper\TextTrackList $this';
105 // @var \Wikimedia\IDLeDOM\Helper\TextTrackList $this
106 $this->_setMissingProp( $name, $value );
107 }
108
109 /**
110 * @param string $name
111 */
112 public function __unset( string $name ): void {
113 '@phan-var \Wikimedia\IDLeDOM\TextTrackList $this';
114 // @var \Wikimedia\IDLeDOM\TextTrackList $this
115 switch ( $name ) {
116 case "length":
117 break;
118 case "onchange":
119 break;
120 case "onaddtrack":
121 break;
122 case "onremovetrack":
123 break;
124 default:
125 return;
126 }
127 $trace = debug_backtrace();
128 while (
129 count( $trace ) > 0 &&
130 $trace[0]['function'] !== "__unset"
131 ) {
132 array_shift( $trace );
133 }
134 trigger_error(
135 'Undefined property' .
136 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
137 ' in ' . ( $trace[0]['file'] ?? '' ) .
138 ' on line ' . ( $trace[0]['line'] ?? '' ),
139 E_USER_NOTICE
140 );
141 }
142
143 /**
144 * @param mixed $offset
145 * @return bool
146 */
147 public function offsetExists( $offset ): bool {
148 return $this->offsetGet( $offset ) !== null;
149 }
150
151 /**
152 * @param mixed $offset
153 * @return mixed
154 */
155 #[\ReturnTypeWillChange]
156 public function offsetGet( $offset ) {
157 '@phan-var \Wikimedia\IDLeDOM\TextTrackList $this';
158 // @var \Wikimedia\IDLeDOM\TextTrackList $this
159 if ( is_numeric( $offset ) ) {
160 return $this->item( $offset );
161 } elseif ( is_string( $offset ) ) {
162 return $this->getTrackById( $offset );
163 }
164 $trace = debug_backtrace();
165 while (
166 count( $trace ) > 0 &&
167 $trace[0]['function'] !== "offsetGet" &&
168 $trace[0]['function'] !== "offsetExists"
169 ) {
170 array_shift( $trace );
171 }
172 while (
173 count( $trace ) > 1 && (
174 $trace[1]['function'] === "offsetGet" ||
175 $trace[1]['function'] === "offsetExists"
176 ) ) {
177 array_shift( $trace );
178 }
179 trigger_error(
180 'Undefined property' .
181 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
182 ' in ' . ( $trace[0]['file'] ?? '' ) .
183 ' on line ' . ( $trace[0]['line'] ?? '' ),
184 E_USER_NOTICE
185 );
186 return null;
187 }
188
189 /**
190 * @param mixed $offset
191 * @param mixed $value
192 */
193 public function offsetSet( $offset, $value ): void {
194 '@phan-var \Wikimedia\IDLeDOM\TextTrackList $this';
195 // @var \Wikimedia\IDLeDOM\TextTrackList $this
196 if ( is_numeric( $offset ) ) {
197 /* Fall through */
198 } elseif ( is_string( $offset ) ) {
199 /* Fall through */
200 }
201 $trace = debug_backtrace();
202 while (
203 count( $trace ) > 0 &&
204 $trace[0]['function'] !== "offsetSet"
205 ) {
206 array_shift( $trace );
207 }
208 trigger_error(
209 'Undefined property' .
210 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
211 ' in ' . ( $trace[0]['file'] ?? '' ) .
212 ' on line ' . ( $trace[0]['line'] ?? '' ),
213 E_USER_NOTICE
214 );
215 }
216
217 /**
218 * @param mixed $offset
219 */
220 public function offsetUnset( $offset ): void {
221 '@phan-var \Wikimedia\IDLeDOM\TextTrackList $this';
222 // @var \Wikimedia\IDLeDOM\TextTrackList $this
223 if ( is_numeric( $offset ) ) {
224 /* Fall through */
225 } elseif ( is_string( $offset ) ) {
226 /* Fall through */
227 }
228 $trace = debug_backtrace();
229 while (
230 count( $trace ) > 0 &&
231 $trace[0]['function'] !== "offsetUnset"
232 ) {
233 array_shift( $trace );
234 }
235 trigger_error(
236 'Undefined property' .
237 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
238 ' in ' . ( $trace[0]['file'] ?? '' ) .
239 ' on line ' . ( $trace[0]['line'] ?? '' ),
240 E_USER_NOTICE
241 );
242 }
243
244 }