Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 249
0.00% covered (danger)
0.00%
0 / 11
CRAP
0.00% covered (danger)
0.00%
0 / 1
Element
0.00% covered (danger)
0.00%
0 / 249
0.00% covered (danger)
0.00%
0 / 11
15500
0.00% covered (danger)
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% covered (danger)
0.00%
0 / 68
0.00% covered (danger)
0.00%
0 / 1
1260
 __isset
0.00% covered (danger)
0.00%
0 / 68
0.00% covered (danger)
0.00%
0 / 1
1260
 __set
0.00% covered (danger)
0.00%
0 / 26
0.00% covered (danger)
0.00%
0 / 1
110
 __unset
0.00% covered (danger)
0.00%
0 / 80
0.00% covered (danger)
0.00%
0 / 1
1406
 setClassList
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getClassName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setClassName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getSlot
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setSlot
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3// AUTOMATICALLY GENERATED.  DO NOT EDIT.
4// Use `composer build` to regenerate.
5
6namespace Wikimedia\IDLeDOM\Helper;
7
8trait Element {
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    abstract protected function _getMissingProp( string $prop );
24
25    /**
26     * Handle an attempt to set a non-existing property on this
27     * object.  The default implementation raises an exception
28     * but the implementor can choose a different behavior:
29     * ignore the operation (like JavaScript), dynamically create
30     * the property, etc.
31     * @param string $prop the name of the property requested
32     * @param mixed $value the value to set
33     */
34    abstract protected function _setMissingProp( string $prop, $value ): void;
35
36    // phpcs:enable
37
38    /**
39     * @param string $name
40     * @return mixed
41     */
42    public function __get( string $name ) {
43        '@phan-var \Wikimedia\IDLeDOM\Element $this';
44        // @var \Wikimedia\IDLeDOM\Element $this
45        switch ( $name ) {
46            case "nodeType":
47                return $this->getNodeType();
48            case "nodeName":
49                return $this->getNodeName();
50            case "baseURI":
51                return $this->getBaseURI();
52            case "isConnected":
53                return $this->getIsConnected();
54            case "ownerDocument":
55                return $this->getOwnerDocument();
56            case "parentNode":
57                return $this->getParentNode();
58            case "parentElement":
59                return $this->getParentElement();
60            case "childNodes":
61                return $this->getChildNodes();
62            case "firstChild":
63                return $this->getFirstChild();
64            case "lastChild":
65                return $this->getLastChild();
66            case "previousSibling":
67                return $this->getPreviousSibling();
68            case "nextSibling":
69                return $this->getNextSibling();
70            case "nodeValue":
71                return $this->getNodeValue();
72            case "textContent":
73                return $this->getTextContent();
74            case "innerHTML":
75                return $this->getInnerHTML();
76            case "previousElementSibling":
77                return $this->getPreviousElementSibling();
78            case "nextElementSibling":
79                return $this->getNextElementSibling();
80            case "children":
81                return $this->getChildren();
82            case "firstElementChild":
83                return $this->getFirstElementChild();
84            case "lastElementChild":
85                return $this->getLastElementChild();
86            case "childElementCount":
87                return $this->getChildElementCount();
88            case "assignedSlot":
89                return $this->getAssignedSlot();
90            case "namespaceURI":
91                return $this->getNamespaceURI();
92            case "prefix":
93                return $this->getPrefix();
94            case "localName":
95                return $this->getLocalName();
96            case "tagName":
97                return $this->getTagName();
98            case "id":
99                return $this->getId();
100            case "className":
101                return $this->getClassName();
102            case "classList":
103                return $this->getClassList();
104            case "slot":
105                return $this->getSlot();
106            case "attributes":
107                return $this->getAttributes();
108            case "shadowRoot":
109                return $this->getShadowRoot();
110            case "outerHTML":
111                return $this->getOuterHTML();
112            default:
113                break;
114        }
115        '@phan-var \Wikimedia\IDLeDOM\Helper\Element $this';
116        // @var \Wikimedia\IDLeDOM\Helper\Element $this
117        return $this->_getMissingProp( $name );
118    }
119
120    /**
121     * @param string $name
122     * @return bool
123     */
124    public function __isset( string $name ): bool {
125        '@phan-var \Wikimedia\IDLeDOM\Element $this';
126        // @var \Wikimedia\IDLeDOM\Element $this
127        switch ( $name ) {
128            case "nodeType":
129                return true;
130            case "nodeName":
131                return true;
132            case "baseURI":
133                return true;
134            case "isConnected":
135                return true;
136            case "ownerDocument":
137                return $this->getOwnerDocument() !== null;
138            case "parentNode":
139                return $this->getParentNode() !== null;
140            case "parentElement":
141                return $this->getParentElement() !== null;
142            case "childNodes":
143                return true;
144            case "firstChild":
145                return $this->getFirstChild() !== null;
146            case "lastChild":
147                return $this->getLastChild() !== null;
148            case "previousSibling":
149                return $this->getPreviousSibling() !== null;
150            case "nextSibling":
151                return $this->getNextSibling() !== null;
152            case "nodeValue":
153                return $this->getNodeValue() !== null;
154            case "textContent":
155                return $this->getTextContent() !== null;
156            case "innerHTML":
157                return true;
158            case "previousElementSibling":
159                return $this->getPreviousElementSibling() !== null;
160            case "nextElementSibling":
161                return $this->getNextElementSibling() !== null;
162            case "children":
163                return true;
164            case "firstElementChild":
165                return $this->getFirstElementChild() !== null;
166            case "lastElementChild":
167                return $this->getLastElementChild() !== null;
168            case "childElementCount":
169                return true;
170            case "assignedSlot":
171                return $this->getAssignedSlot() !== null;
172            case "namespaceURI":
173                return $this->getNamespaceURI() !== null;
174            case "prefix":
175                return $this->getPrefix() !== null;
176            case "localName":
177                return true;
178            case "tagName":
179                return true;
180            case "id":
181                return true;
182            case "className":
183                return true;
184            case "classList":
185                return true;
186            case "slot":
187                return true;
188            case "attributes":
189                return true;
190            case "shadowRoot":
191                return $this->getShadowRoot() !== null;
192            case "outerHTML":
193                return true;
194            default:
195                break;
196        }
197        return false;
198    }
199
200    /**
201     * @param string $name
202     * @param mixed $value
203     */
204    public function __set( string $name, $value ): void {
205        '@phan-var \Wikimedia\IDLeDOM\Element $this';
206        // @var \Wikimedia\IDLeDOM\Element $this
207        switch ( $name ) {
208            case "nodeValue":
209                $this->setNodeValue( $value );
210                return;
211            case "textContent":
212                $this->setTextContent( $value );
213                return;
214            case "innerHTML":
215                $this->setInnerHTML( $value );
216                return;
217            case "id":
218                $this->setId( $value );
219                return;
220            case "className":
221                $this->setClassName( $value );
222                return;
223            case "classList":
224                $this->setClassList( $value );
225                return;
226            case "slot":
227                $this->setSlot( $value );
228                return;
229            case "outerHTML":
230                $this->setOuterHTML( $value );
231                return;
232            default:
233                break;
234        }
235        '@phan-var \Wikimedia\IDLeDOM\Helper\Element $this';
236        // @var \Wikimedia\IDLeDOM\Helper\Element $this
237        $this->_setMissingProp( $name, $value );
238    }
239
240    /**
241     * @param string $name
242     */
243    public function __unset( string $name ): void {
244        '@phan-var \Wikimedia\IDLeDOM\Element $this';
245        // @var \Wikimedia\IDLeDOM\Element $this
246        switch ( $name ) {
247            case "nodeType":
248                break;
249            case "nodeName":
250                break;
251            case "baseURI":
252                break;
253            case "isConnected":
254                break;
255            case "ownerDocument":
256                break;
257            case "parentNode":
258                break;
259            case "parentElement":
260                break;
261            case "childNodes":
262                break;
263            case "firstChild":
264                break;
265            case "lastChild":
266                break;
267            case "previousSibling":
268                break;
269            case "nextSibling":
270                break;
271            case "nodeValue":
272                $this->setNodeValue( null );
273                return;
274            case "textContent":
275                $this->setTextContent( null );
276                return;
277            case "innerHTML":
278                break;
279            case "previousElementSibling":
280                break;
281            case "nextElementSibling":
282                break;
283            case "children":
284                break;
285            case "firstElementChild":
286                break;
287            case "lastElementChild":
288                break;
289            case "childElementCount":
290                break;
291            case "assignedSlot":
292                break;
293            case "namespaceURI":
294                break;
295            case "prefix":
296                break;
297            case "localName":
298                break;
299            case "tagName":
300                break;
301            case "id":
302                break;
303            case "className":
304                break;
305            case "classList":
306                break;
307            case "slot":
308                break;
309            case "attributes":
310                break;
311            case "shadowRoot":
312                break;
313            case "outerHTML":
314                break;
315            default:
316                return;
317        }
318        $trace = debug_backtrace();
319        while (
320            count( $trace ) > 0 &&
321            $trace[0]['function'] !== "__unset"
322        ) {
323            array_shift( $trace );
324        }
325        trigger_error(
326            'Undefined property' .
327            ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
328            ' in ' . ( $trace[0]['file'] ?? '' ) .
329            ' on line ' . ( $trace[0]['line'] ?? '' ),
330            E_USER_NOTICE
331        );
332    }
333
334    /**
335     * @param string $val
336     */
337    public function setClassList( string $val ): void {
338        '@phan-var \Wikimedia\IDLeDOM\Element $this';
339        // @var \Wikimedia\IDLeDOM\Element $this
340        $this->getClassList()->setValue( $val );
341    }
342
343    /**
344     * @return string
345     */
346    public function getId(): string {
347        '@phan-var \Wikimedia\IDLeDOM\Element $this';
348        // @var \Wikimedia\IDLeDOM\Element $this
349        return $this->getAttribute( 'id' ) ?? '';
350    }
351
352    /**
353     * @param string $val
354     */
355    public function setId( string $val ): void {
356        '@phan-var \Wikimedia\IDLeDOM\Element $this';
357        // @var \Wikimedia\IDLeDOM\Element $this
358        $this->setAttribute( 'id', $val );
359    }
360
361    /**
362     * @return string
363     */
364    public function getClassName(): string {
365        '@phan-var \Wikimedia\IDLeDOM\Element $this';
366        // @var \Wikimedia\IDLeDOM\Element $this
367        return $this->getAttribute( 'class' ) ?? '';
368    }
369
370    /**
371     * @param string $val
372     */
373    public function setClassName( string $val ): void {
374        '@phan-var \Wikimedia\IDLeDOM\Element $this';
375        // @var \Wikimedia\IDLeDOM\Element $this
376        $this->setAttribute( 'class', $val );
377    }
378
379    /**
380     * @return string
381     */
382    public function getSlot(): string {
383        '@phan-var \Wikimedia\IDLeDOM\Element $this';
384        // @var \Wikimedia\IDLeDOM\Element $this
385        return $this->getAttribute( 'slot' ) ?? '';
386    }
387
388    /**
389     * @param string $val
390     */
391    public function setSlot( string $val ): void {
392        '@phan-var \Wikimedia\IDLeDOM\Element $this';
393        // @var \Wikimedia\IDLeDOM\Element $this
394        $this->setAttribute( 'slot', $val );
395    }
396
397}