Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 50 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
ShadowRootInit | |
0.00% |
0 / 50 |
|
0.00% |
0 / 9 |
552 | |
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 / 6 |
|
0.00% |
0 / 1 |
20 | |||
__isset | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
20 | |||
offsetExists | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
20 | |||
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 / 7 |
|
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\ShadowRootMode; |
9 | |
10 | trait ShadowRootInit { |
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 | protected function _getMissingProp( string $prop ) { |
26 | $trace = debug_backtrace(); |
27 | while ( |
28 | count( $trace ) > 0 && |
29 | $trace[0]['function'] !== "__get" |
30 | ) { |
31 | array_shift( $trace ); |
32 | } |
33 | trigger_error( |
34 | 'Undefined property' . |
35 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop . |
36 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
37 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
38 | E_USER_NOTICE |
39 | ); |
40 | return null; |
41 | } |
42 | |
43 | /** |
44 | * Handle an attempt to set a non-existing property on this |
45 | * object. The default implementation raises an exception |
46 | * but the implementor can choose a different behavior: |
47 | * ignore the operation (like JavaScript), dynamically create |
48 | * the property, etc. |
49 | * @param string $prop the name of the property requested |
50 | * @param mixed $value the value to set |
51 | */ |
52 | protected function _setMissingProp( string $prop, $value ): void { |
53 | $trace = debug_backtrace(); |
54 | while ( |
55 | count( $trace ) > 0 && |
56 | $trace[0]['function'] !== "__set" |
57 | ) { |
58 | array_shift( $trace ); |
59 | } |
60 | trigger_error( |
61 | 'Undefined property' . |
62 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop . |
63 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
64 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
65 | E_USER_NOTICE |
66 | ); |
67 | } |
68 | |
69 | // phpcs:enable |
70 | |
71 | /** |
72 | * @param string $name |
73 | * @return mixed |
74 | */ |
75 | public function __get( string $name ) { |
76 | '@phan-var \Wikimedia\IDLeDOM\ShadowRootInit $this'; |
77 | // @var \Wikimedia\IDLeDOM\ShadowRootInit $this |
78 | switch ( $name ) { |
79 | case "mode": |
80 | return $this->getMode(); |
81 | case "delegatesFocus": |
82 | return $this->getDelegatesFocus(); |
83 | default: |
84 | break; |
85 | } |
86 | '@phan-var \Wikimedia\IDLeDOM\Helper\ShadowRootInit $this'; |
87 | // @var \Wikimedia\IDLeDOM\Helper\ShadowRootInit $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\ShadowRootInit $this'; |
97 | // @var \Wikimedia\IDLeDOM\ShadowRootInit $this |
98 | switch ( $name ) { |
99 | case "mode": |
100 | return true; |
101 | case "delegatesFocus": |
102 | return true; |
103 | default: |
104 | break; |
105 | } |
106 | return false; |
107 | } |
108 | |
109 | /** |
110 | * @param mixed $offset |
111 | * @return bool |
112 | */ |
113 | public function offsetExists( $offset ): bool { |
114 | switch ( $offset ) { |
115 | case "mode": |
116 | case "delegatesFocus": |
117 | return true; |
118 | default: |
119 | break; |
120 | } |
121 | return false; |
122 | } |
123 | |
124 | /** |
125 | * @param mixed $offset |
126 | * @return mixed |
127 | */ |
128 | #[\ReturnTypeWillChange] |
129 | public function offsetGet( $offset ) { |
130 | return $this->$offset; |
131 | } |
132 | |
133 | /** |
134 | * @param mixed $offset |
135 | * @param mixed $value |
136 | */ |
137 | public function offsetSet( $offset, $value ): void { |
138 | $this->$offset = $value; |
139 | } |
140 | |
141 | /** |
142 | * @param mixed $offset |
143 | */ |
144 | public function offsetUnset( $offset ): void { |
145 | unset( $this->$offset ); |
146 | } |
147 | |
148 | /** |
149 | * Create a ShadowRootInit from an associative array. |
150 | * |
151 | * @param array|\Wikimedia\IDLeDOM\ShadowRootInit $a |
152 | * @return \Wikimedia\IDLeDOM\ShadowRootInit |
153 | */ |
154 | public static function cast( $a ) { |
155 | if ( $a instanceof \Wikimedia\IDLeDOM\ShadowRootInit ) { |
156 | return $a; |
157 | } |
158 | return new class( $a ) extends \Wikimedia\IDLeDOM\ShadowRootInit { |
159 | use ShadowRootInit; |
160 | |
161 | /** @var array */ |
162 | private $a; |
163 | |
164 | /** |
165 | * @param array $a |
166 | */ |
167 | public function __construct( $a ) { |
168 | $this->a = $a; |
169 | } |
170 | |
171 | /** |
172 | * @return string |
173 | */ |
174 | public function getMode(): /* ShadowRootMode */ string { |
175 | return ShadowRootMode::cast( $this->a["mode"] ); |
176 | } |
177 | |
178 | /** |
179 | * @return bool |
180 | */ |
181 | public function getDelegatesFocus(): bool { |
182 | return $this->a["delegatesFocus"] ?? false; |
183 | } |
184 | |
185 | }; |
186 | } |
187 | |
188 | } |