Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/RadioNodeList.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 use Wikimedia\IDLeDOM\Node;
9
10 trait RadioNodeList {
11
12 // Underscore is used to avoid conflicts with DOM-reserved names
13 // phpcs:disable PSR2.Methods.MethodDeclaration.Underscore
14 // phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
15
16 /**
17 * Handle an attempt to get a non-existing property on this
18 * object. The default implementation raises an exception
19 * but the implementor can choose a different behavior:
20 * return null (like JavaScript), dynamically create the
21 * property, etc.
22 * @param string $prop the name of the property requested
23 * @return mixed
24 */
25 abstract protected function _getMissingProp( string $prop );
26
27 /**
28 * Handle an attempt to set a non-existing property on this
29 * object. The default implementation raises an exception
30 * but the implementor can choose a different behavior:
31 * ignore the operation (like JavaScript), dynamically create
32 * the property, etc.
33 * @param string $prop the name of the property requested
34 * @param mixed $value the value to set
35 */
36 abstract protected function _setMissingProp( string $prop, $value ): void;
37
38 // phpcs:enable
39
40 /**
41 * @param string $name
42 * @return mixed
43 */
44 public function __get( string $name ) {
45 '@phan-var \Wikimedia\IDLeDOM\RadioNodeList $this';
46 // @var \Wikimedia\IDLeDOM\RadioNodeList $this
47 switch ( $name ) {
48 case "length":
49 return $this->getLength();
50 case "value":
51 return $this->getValue();
52 default:
53 break;
54 }
55 '@phan-var \Wikimedia\IDLeDOM\Helper\RadioNodeList $this';
56 // @var \Wikimedia\IDLeDOM\Helper\RadioNodeList $this
57 return $this->_getMissingProp( $name );
58 }
59
60 /**
61 * @param string $name
62 * @return bool
63 */
64 public function __isset( string $name ): bool {
65 '@phan-var \Wikimedia\IDLeDOM\RadioNodeList $this';
66 // @var \Wikimedia\IDLeDOM\RadioNodeList $this
67 switch ( $name ) {
68 case "length":
69 return true;
70 case "value":
71 return true;
72 default:
73 break;
74 }
75 return false;
76 }
77
78 /**
79 * @param string $name
80 * @param mixed $value
81 */
82 public function __set( string $name, $value ): void {
83 '@phan-var \Wikimedia\IDLeDOM\RadioNodeList $this';
84 // @var \Wikimedia\IDLeDOM\RadioNodeList $this
85 switch ( $name ) {
86 case "value":
87 $this->setValue( $value );
88 return;
89 default:
90 break;
91 }
92 '@phan-var \Wikimedia\IDLeDOM\Helper\RadioNodeList $this';
93 // @var \Wikimedia\IDLeDOM\Helper\RadioNodeList $this
94 $this->_setMissingProp( $name, $value );
95 }
96
97 /**
98 * @param string $name
99 */
100 public function __unset( string $name ): void {
101 '@phan-var \Wikimedia\IDLeDOM\RadioNodeList $this';
102 // @var \Wikimedia\IDLeDOM\RadioNodeList $this
103 switch ( $name ) {
104 case "length":
105 break;
106 case "value":
107 break;
108 default:
109 return;
110 }
111 $trace = debug_backtrace();
112 while (
113 count( $trace ) > 0 &&
114 $trace[0]['function'] !== "__unset"
115 ) {
116 array_shift( $trace );
117 }
118 trigger_error(
119 'Undefined property' .
120 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
121 ' in ' . ( $trace[0]['file'] ?? '' ) .
122 ' on line ' . ( $trace[0]['line'] ?? '' ),
123 E_USER_NOTICE
124 );
125 }
126
127 /**
128 * @return int
129 */
130 public function count(): int {
131 '@phan-var \Wikimedia\IDLeDOM\RadioNodeList $this';
132 // @var \Wikimedia\IDLeDOM\RadioNodeList $this
133 return $this->getLength();
134 }
135
136 /**
137 * @param mixed $offset
138 * @return bool
139 */
140 public function offsetExists( $offset ): bool {
141 return $this->offsetGet( $offset ) !== null;
142 }
143
144 /**
145 * @param mixed $offset
146 * @return mixed
147 */
148 #[\ReturnTypeWillChange]
149 public function offsetGet( $offset ) {
150 '@phan-var \Wikimedia\IDLeDOM\RadioNodeList $this';
151 // @var \Wikimedia\IDLeDOM\RadioNodeList $this
152 if ( is_numeric( $offset ) ) {
153 return $this->item( $offset );
154 } elseif ( is_string( $offset ) ) {
155 /* Fall through */
156 }
157 $trace = debug_backtrace();
158 while (
159 count( $trace ) > 0 &&
160 $trace[0]['function'] !== "offsetGet" &&
161 $trace[0]['function'] !== "offsetExists"
162 ) {
163 array_shift( $trace );
164 }
165 while (
166 count( $trace ) > 1 && (
167 $trace[1]['function'] === "offsetGet" ||
168 $trace[1]['function'] === "offsetExists"
169 ) ) {
170 array_shift( $trace );
171 }
172 trigger_error(
173 'Undefined property' .
174 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
175 ' in ' . ( $trace[0]['file'] ?? '' ) .
176 ' on line ' . ( $trace[0]['line'] ?? '' ),
177 E_USER_NOTICE
178 );
179 return null;
180 }
181
182 /**
183 * @param mixed $offset
184 * @param mixed $value
185 */
186 public function offsetSet( $offset, $value ): void {
187 '@phan-var \Wikimedia\IDLeDOM\RadioNodeList $this';
188 // @var \Wikimedia\IDLeDOM\RadioNodeList $this
189 if ( is_numeric( $offset ) ) {
190 /* Fall through */
191 } elseif ( is_string( $offset ) ) {
192 /* Fall through */
193 }
194 $trace = debug_backtrace();
195 while (
196 count( $trace ) > 0 &&
197 $trace[0]['function'] !== "offsetSet"
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 }
209
210 /**
211 * @param mixed $offset
212 */
213 public function offsetUnset( $offset ): void {
214 '@phan-var \Wikimedia\IDLeDOM\RadioNodeList $this';
215 // @var \Wikimedia\IDLeDOM\RadioNodeList $this
216 if ( is_numeric( $offset ) ) {
217 /* Fall through */
218 } elseif ( is_string( $offset ) ) {
219 /* Fall through */
220 }
221 $trace = debug_backtrace();
222 while (
223 count( $trace ) > 0 &&
224 $trace[0]['function'] !== "offsetUnset"
225 ) {
226 array_shift( $trace );
227 }
228 trigger_error(
229 'Undefined property' .
230 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset .
231 ' in ' . ( $trace[0]['file'] ?? '' ) .
232 ' on line ' . ( $trace[0]['line'] ?? '' ),
233 E_USER_NOTICE
234 );
235 }
236
237 /**
238 * @return \Iterator<Node> Value iterator returning Node items
239 */
240 public function getIterator(): \Iterator {
241 '@phan-var \Wikimedia\IDLeDOM\RadioNodeList $this';
242 // @var \Wikimedia\IDLeDOM\RadioNodeList $this
243 for ( $i = 0; $i < $this->getLength(); $i++ ) {
244 yield $this->item( $i );
245 }
246 }
247
248 }