Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 56 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
EventInit | |
0.00% |
0 / 56 |
|
0.00% |
0 / 9 |
702 | |
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 / 8 |
|
0.00% |
0 / 1 |
30 | |||
__isset | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
30 | |||
offsetExists | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
30 | |||
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 / 8 |
|
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 EventInit { |
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\EventInit $this'; |
75 | // @var \Wikimedia\IDLeDOM\EventInit $this |
76 | switch ( $name ) { |
77 | case "bubbles": |
78 | return $this->getBubbles(); |
79 | case "cancelable": |
80 | return $this->getCancelable(); |
81 | case "composed": |
82 | return $this->getComposed(); |
83 | default: |
84 | break; |
85 | } |
86 | '@phan-var \Wikimedia\IDLeDOM\Helper\EventInit $this'; |
87 | // @var \Wikimedia\IDLeDOM\Helper\EventInit $this |
88 | return $this->_getMissingProp( $name ); |
89 | } |
90 | |
91 | /** |
92 | * @param string $name |
93 | * @return bool |
94 | */ |
95 | public function __isset( string $name ): bool { |
96 | '@phan-var \Wikimedia\IDLeDOM\EventInit $this'; |
97 | // @var \Wikimedia\IDLeDOM\EventInit $this |
98 | switch ( $name ) { |
99 | case "bubbles": |
100 | return true; |
101 | case "cancelable": |
102 | return true; |
103 | case "composed": |
104 | return true; |
105 | default: |
106 | break; |
107 | } |
108 | return false; |
109 | } |
110 | |
111 | /** |
112 | * @param mixed $offset |
113 | * @return bool |
114 | */ |
115 | public function offsetExists( $offset ): bool { |
116 | switch ( $offset ) { |
117 | case "bubbles": |
118 | case "cancelable": |
119 | case "composed": |
120 | return true; |
121 | default: |
122 | break; |
123 | } |
124 | return false; |
125 | } |
126 | |
127 | /** |
128 | * @param mixed $offset |
129 | * @return mixed |
130 | */ |
131 | #[\ReturnTypeWillChange] |
132 | public function offsetGet( $offset ) { |
133 | return $this->$offset; |
134 | } |
135 | |
136 | /** |
137 | * @param mixed $offset |
138 | * @param mixed $value |
139 | */ |
140 | public function offsetSet( $offset, $value ): void { |
141 | $this->$offset = $value; |
142 | } |
143 | |
144 | /** |
145 | * @param mixed $offset |
146 | */ |
147 | public function offsetUnset( $offset ): void { |
148 | unset( $this->$offset ); |
149 | } |
150 | |
151 | /** |
152 | * Create a EventInit from an associative array. |
153 | * |
154 | * @param array|\Wikimedia\IDLeDOM\EventInit $a |
155 | * @return \Wikimedia\IDLeDOM\EventInit |
156 | */ |
157 | public static function cast( $a ) { |
158 | if ( $a instanceof \Wikimedia\IDLeDOM\EventInit ) { |
159 | return $a; |
160 | } |
161 | return new class( $a ) extends \Wikimedia\IDLeDOM\EventInit { |
162 | use EventInit; |
163 | |
164 | /** @var array */ |
165 | private $a; |
166 | |
167 | /** |
168 | * @param array $a |
169 | */ |
170 | public function __construct( $a ) { |
171 | $this->a = $a; |
172 | } |
173 | |
174 | /** |
175 | * @return bool |
176 | */ |
177 | public function getBubbles(): bool { |
178 | return $this->a["bubbles"] ?? false; |
179 | } |
180 | |
181 | /** |
182 | * @return bool |
183 | */ |
184 | public function getCancelable(): bool { |
185 | return $this->a["cancelable"] ?? false; |
186 | } |
187 | |
188 | /** |
189 | * @return bool |
190 | */ |
191 | public function getComposed(): bool { |
192 | return $this->a["composed"] ?? false; |
193 | } |
194 | |
195 | }; |
196 | } |
197 | |
198 | } |