Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 39 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
AddEventListenerOptions | |
0.00% |
0 / 39 |
|
0.00% |
0 / 7 |
552 | |
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 / 10 |
|
0.00% |
0 / 1 |
42 | |||
__isset | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
42 | |||
offsetExists | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
42 | |||
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 / 9 |
|
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\AbortSignal; |
9 | |
10 | trait AddEventListenerOptions { |
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\AddEventListenerOptions $this'; |
46 | // @var \Wikimedia\IDLeDOM\AddEventListenerOptions $this |
47 | switch ( $name ) { |
48 | case "capture": |
49 | return $this->getCapture(); |
50 | case "passive": |
51 | return $this->getPassive(); |
52 | case "once": |
53 | return $this->getOnce(); |
54 | case "signal": |
55 | return $this->getSignal(); |
56 | default: |
57 | break; |
58 | } |
59 | '@phan-var \Wikimedia\IDLeDOM\Helper\AddEventListenerOptions $this'; |
60 | // @var \Wikimedia\IDLeDOM\Helper\AddEventListenerOptions $this |
61 | return $this->_getMissingProp( $name ); |
62 | } |
63 | |
64 | /** |
65 | * @param string $name |
66 | * @return bool |
67 | */ |
68 | public function __isset( string $name ): bool { |
69 | '@phan-var \Wikimedia\IDLeDOM\AddEventListenerOptions $this'; |
70 | // @var \Wikimedia\IDLeDOM\AddEventListenerOptions $this |
71 | switch ( $name ) { |
72 | case "capture": |
73 | return true; |
74 | case "passive": |
75 | return true; |
76 | case "once": |
77 | return true; |
78 | case "signal": |
79 | return true; |
80 | default: |
81 | break; |
82 | } |
83 | return false; |
84 | } |
85 | |
86 | /** |
87 | * @param mixed $offset |
88 | * @return bool |
89 | */ |
90 | public function offsetExists( $offset ): bool { |
91 | switch ( $offset ) { |
92 | case "capture": |
93 | case "passive": |
94 | case "once": |
95 | case "signal": |
96 | return true; |
97 | default: |
98 | break; |
99 | } |
100 | return false; |
101 | } |
102 | |
103 | /** |
104 | * @param mixed $offset |
105 | * @return mixed |
106 | */ |
107 | #[\ReturnTypeWillChange] |
108 | public function offsetGet( $offset ) { |
109 | return $this->$offset; |
110 | } |
111 | |
112 | /** |
113 | * @param mixed $offset |
114 | * @param mixed $value |
115 | */ |
116 | public function offsetSet( $offset, $value ): void { |
117 | $this->$offset = $value; |
118 | } |
119 | |
120 | /** |
121 | * @param mixed $offset |
122 | */ |
123 | public function offsetUnset( $offset ): void { |
124 | unset( $this->$offset ); |
125 | } |
126 | |
127 | /** |
128 | * Create a AddEventListenerOptions from an associative array. |
129 | * |
130 | * @param array|\Wikimedia\IDLeDOM\AddEventListenerOptions $a |
131 | * @return \Wikimedia\IDLeDOM\AddEventListenerOptions |
132 | */ |
133 | public static function cast( $a ) { |
134 | if ( $a instanceof \Wikimedia\IDLeDOM\AddEventListenerOptions ) { |
135 | return $a; |
136 | } |
137 | return new class( $a ) extends \Wikimedia\IDLeDOM\AddEventListenerOptions { |
138 | use AddEventListenerOptions; |
139 | |
140 | /** @var array */ |
141 | private $a; |
142 | |
143 | /** |
144 | * @param array $a |
145 | */ |
146 | public function __construct( $a ) { |
147 | $this->a = $a; |
148 | } |
149 | |
150 | /** |
151 | * @return bool |
152 | */ |
153 | public function getCapture(): bool { |
154 | return $this->a["capture"] ?? false; |
155 | } |
156 | |
157 | /** |
158 | * @return bool |
159 | */ |
160 | public function getPassive(): bool { |
161 | return $this->a["passive"] ?? false; |
162 | } |
163 | |
164 | /** |
165 | * @return bool |
166 | */ |
167 | public function getOnce(): bool { |
168 | return $this->a["once"] ?? false; |
169 | } |
170 | |
171 | /** |
172 | * @return AbortSignal |
173 | */ |
174 | public function getSignal() { |
175 | return $this->a["signal"]; |
176 | } |
177 | |
178 | }; |
179 | } |
180 | |
181 | } |