Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 60 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 1 |
HTMLFormControlsCollection | |
0.00% |
0 / 60 |
|
0.00% |
0 / 8 |
870 | |
0.00% |
0 / 1 |
_getMissingProp | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
_setMissingProp | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
__get | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
__isset | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
count | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
offsetExists | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
offsetGet | |
0.00% |
0 / 22 |
|
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 | |||
getIterator | |
0.00% |
0 / 2 |
|
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 | use Wikimedia\IDLeDOM\Element; |
9 | |
10 | trait HTMLFormControlsCollection { |
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\HTMLFormControlsCollection $this'; |
46 | // @var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this |
47 | switch ( $name ) { |
48 | case "length": |
49 | return $this->getLength(); |
50 | default: |
51 | break; |
52 | } |
53 | '@phan-var \Wikimedia\IDLeDOM\Helper\HTMLFormControlsCollection $this'; |
54 | // @var \Wikimedia\IDLeDOM\Helper\HTMLFormControlsCollection $this |
55 | return $this->_getMissingProp( $name ); |
56 | } |
57 | |
58 | /** |
59 | * @param string $name |
60 | * @return bool |
61 | */ |
62 | public function __isset( string $name ): bool { |
63 | '@phan-var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this'; |
64 | // @var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this |
65 | switch ( $name ) { |
66 | case "length": |
67 | return true; |
68 | default: |
69 | break; |
70 | } |
71 | return false; |
72 | } |
73 | |
74 | /** |
75 | * @return int |
76 | */ |
77 | public function count(): int { |
78 | '@phan-var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this'; |
79 | // @var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this |
80 | return $this->getLength(); |
81 | } |
82 | |
83 | /** |
84 | * @param mixed $offset |
85 | * @return bool |
86 | */ |
87 | public function offsetExists( $offset ): bool { |
88 | return $this->offsetGet( $offset ) !== null; |
89 | } |
90 | |
91 | /** |
92 | * @param mixed $offset |
93 | * @return mixed |
94 | */ |
95 | #[\ReturnTypeWillChange] |
96 | public function offsetGet( $offset ) { |
97 | '@phan-var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this'; |
98 | // @var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this |
99 | if ( is_numeric( $offset ) ) { |
100 | return $this->item( $offset ); |
101 | } elseif ( is_string( $offset ) ) { |
102 | return $this->namedItem( $offset ); |
103 | } |
104 | $trace = debug_backtrace(); |
105 | while ( |
106 | count( $trace ) > 0 && |
107 | $trace[0]['function'] !== "offsetGet" && |
108 | $trace[0]['function'] !== "offsetExists" |
109 | ) { |
110 | array_shift( $trace ); |
111 | } |
112 | while ( |
113 | count( $trace ) > 1 && ( |
114 | $trace[1]['function'] === "offsetGet" || |
115 | $trace[1]['function'] === "offsetExists" |
116 | ) ) { |
117 | array_shift( $trace ); |
118 | } |
119 | trigger_error( |
120 | 'Undefined property' . |
121 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
122 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
123 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
124 | E_USER_NOTICE |
125 | ); |
126 | return null; |
127 | } |
128 | |
129 | /** |
130 | * @param mixed $offset |
131 | * @param mixed $value |
132 | */ |
133 | public function offsetSet( $offset, $value ): void { |
134 | '@phan-var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this'; |
135 | // @var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this |
136 | if ( is_numeric( $offset ) ) { |
137 | /* Fall through */ |
138 | } elseif ( is_string( $offset ) ) { |
139 | /* Fall through */ |
140 | } |
141 | $trace = debug_backtrace(); |
142 | while ( |
143 | count( $trace ) > 0 && |
144 | $trace[0]['function'] !== "offsetSet" |
145 | ) { |
146 | array_shift( $trace ); |
147 | } |
148 | trigger_error( |
149 | 'Undefined property' . |
150 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
151 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
152 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
153 | E_USER_NOTICE |
154 | ); |
155 | } |
156 | |
157 | /** |
158 | * @param mixed $offset |
159 | */ |
160 | public function offsetUnset( $offset ): void { |
161 | '@phan-var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this'; |
162 | // @var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this |
163 | if ( is_numeric( $offset ) ) { |
164 | /* Fall through */ |
165 | } elseif ( is_string( $offset ) ) { |
166 | /* Fall through */ |
167 | } |
168 | $trace = debug_backtrace(); |
169 | while ( |
170 | count( $trace ) > 0 && |
171 | $trace[0]['function'] !== "offsetUnset" |
172 | ) { |
173 | array_shift( $trace ); |
174 | } |
175 | trigger_error( |
176 | 'Undefined property' . |
177 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
178 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
179 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
180 | E_USER_NOTICE |
181 | ); |
182 | } |
183 | |
184 | /** |
185 | * @return \Iterator<Element> Value iterator returning Element items |
186 | */ |
187 | public function getIterator(): \Iterator { |
188 | '@phan-var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this'; |
189 | // @var \Wikimedia\IDLeDOM\HTMLFormControlsCollection $this |
190 | for ( $i = 0; $i < $this->getLength(); $i++ ) { |
191 | yield $this->item( $i ); |
192 | } |
193 | } |
194 | |
195 | } |