Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 403
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
Document
0.00% covered (danger)
0.00%
0 / 403
0.00% covered (danger)
0.00%
0 / 5
37830
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 / 114
0.00% covered (danger)
0.00%
0 / 1
3422
 __isset
0.00% covered (danger)
0.00%
0 / 114
0.00% covered (danger)
0.00%
0 / 1
3422
 __set
0.00% covered (danger)
0.00%
0 / 47
0.00% covered (danger)
0.00%
0 / 1
306
 __unset
0.00% covered (danger)
0.00%
0 / 127
0.00% covered (danger)
0.00%
0 / 1
3660
 setLocation
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 Document {
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\Document $this';
44        // @var \Wikimedia\IDLeDOM\Document $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 "styleSheets":
75                return $this->getStyleSheets();
76            case "onload":
77                return $this->getOnload();
78            case "children":
79                return $this->getChildren();
80            case "firstElementChild":
81                return $this->getFirstElementChild();
82            case "lastElementChild":
83                return $this->getLastElementChild();
84            case "childElementCount":
85                return $this->getChildElementCount();
86            case "implementation":
87                return $this->getImplementation();
88            case "URL":
89                return $this->getURL();
90            case "documentURI":
91                return $this->getDocumentURI();
92            case "compatMode":
93                return $this->getCompatMode();
94            case "characterSet":
95                return $this->getCharacterSet();
96            case "charset":
97                return $this->getCharset();
98            case "inputEncoding":
99                return $this->getInputEncoding();
100            case "contentType":
101                return $this->getContentType();
102            case "doctype":
103                return $this->getDoctype();
104            case "documentElement":
105                return $this->getDocumentElement();
106            case "location":
107                return $this->getLocation();
108            case "referrer":
109                return $this->getReferrer();
110            case "cookie":
111                return $this->getCookie();
112            case "lastModified":
113                return $this->getLastModified();
114            case "title":
115                return $this->getTitle();
116            case "dir":
117                return $this->getDir();
118            case "body":
119                return $this->getBody();
120            case "head":
121                return $this->getHead();
122            case "images":
123                return $this->getImages();
124            case "embeds":
125                return $this->getEmbeds();
126            case "plugins":
127                return $this->getPlugins();
128            case "links":
129                return $this->getLinks();
130            case "forms":
131                return $this->getForms();
132            case "scripts":
133                return $this->getScripts();
134            case "currentScript":
135                return $this->getCurrentScript();
136            case "onreadystatechange":
137                return $this->getOnreadystatechange();
138            case "anchors":
139                return $this->getAnchors();
140            case "applets":
141                return $this->getApplets();
142            case "hidden":
143                return $this->getHidden();
144            case "visibilityState":
145                return $this->getVisibilityState();
146            case "onvisibilitychange":
147                return $this->getOnvisibilitychange();
148            case "encoding":
149                return $this->getEncoding();
150            case "preserveWhiteSpace":
151                return $this->getPreserveWhiteSpace();
152            case "formatOutput":
153                return $this->getFormatOutput();
154            case "validateOnParse":
155                return $this->getValidateOnParse();
156            case "strictErrorChecking":
157                return $this->getStrictErrorChecking();
158            default:
159                break;
160        }
161        '@phan-var \Wikimedia\IDLeDOM\Helper\Document $this';
162        // @var \Wikimedia\IDLeDOM\Helper\Document $this
163        return $this->_getMissingProp( $name );
164    }
165
166    /**
167     * @param string $name
168     * @return bool
169     */
170    public function __isset( string $name ): bool {
171        '@phan-var \Wikimedia\IDLeDOM\Document $this';
172        // @var \Wikimedia\IDLeDOM\Document $this
173        switch ( $name ) {
174            case "nodeType":
175                return true;
176            case "nodeName":
177                return true;
178            case "baseURI":
179                return true;
180            case "isConnected":
181                return true;
182            case "ownerDocument":
183                return $this->getOwnerDocument() !== null;
184            case "parentNode":
185                return $this->getParentNode() !== null;
186            case "parentElement":
187                return $this->getParentElement() !== null;
188            case "childNodes":
189                return true;
190            case "firstChild":
191                return $this->getFirstChild() !== null;
192            case "lastChild":
193                return $this->getLastChild() !== null;
194            case "previousSibling":
195                return $this->getPreviousSibling() !== null;
196            case "nextSibling":
197                return $this->getNextSibling() !== null;
198            case "nodeValue":
199                return $this->getNodeValue() !== null;
200            case "textContent":
201                return $this->getTextContent() !== null;
202            case "styleSheets":
203                return true;
204            case "onload":
205                return true;
206            case "children":
207                return true;
208            case "firstElementChild":
209                return $this->getFirstElementChild() !== null;
210            case "lastElementChild":
211                return $this->getLastElementChild() !== null;
212            case "childElementCount":
213                return true;
214            case "implementation":
215                return true;
216            case "URL":
217                return true;
218            case "documentURI":
219                return true;
220            case "compatMode":
221                return true;
222            case "characterSet":
223                return true;
224            case "charset":
225                return true;
226            case "inputEncoding":
227                return true;
228            case "contentType":
229                return true;
230            case "doctype":
231                return $this->getDoctype() !== null;
232            case "documentElement":
233                return $this->getDocumentElement() !== null;
234            case "location":
235                return $this->getLocation() !== null;
236            case "referrer":
237                return true;
238            case "cookie":
239                return true;
240            case "lastModified":
241                return true;
242            case "title":
243                return true;
244            case "dir":
245                return true;
246            case "body":
247                return $this->getBody() !== null;
248            case "head":
249                return $this->getHead() !== null;
250            case "images":
251                return true;
252            case "embeds":
253                return true;
254            case "plugins":
255                return true;
256            case "links":
257                return true;
258            case "forms":
259                return true;
260            case "scripts":
261                return true;
262            case "currentScript":
263                return $this->getCurrentScript() !== null;
264            case "onreadystatechange":
265                return true;
266            case "anchors":
267                return true;
268            case "applets":
269                return true;
270            case "hidden":
271                return true;
272            case "visibilityState":
273                return true;
274            case "onvisibilitychange":
275                return true;
276            case "encoding":
277                return true;
278            case "preserveWhiteSpace":
279                return true;
280            case "formatOutput":
281                return true;
282            case "validateOnParse":
283                return true;
284            case "strictErrorChecking":
285                return true;
286            default:
287                break;
288        }
289        return false;
290    }
291
292    /**
293     * @param string $name
294     * @param mixed $value
295     */
296    public function __set( string $name, $value ): void {
297        '@phan-var \Wikimedia\IDLeDOM\Document $this';
298        // @var \Wikimedia\IDLeDOM\Document $this
299        switch ( $name ) {
300            case "nodeValue":
301                $this->setNodeValue( $value );
302                return;
303            case "textContent":
304                $this->setTextContent( $value );
305                return;
306            case "onload":
307                $this->setOnload( $value );
308                return;
309            case "location":
310                $this->setLocation( $value );
311                return;
312            case "cookie":
313                $this->setCookie( $value );
314                return;
315            case "title":
316                $this->setTitle( $value );
317                return;
318            case "dir":
319                $this->setDir( $value );
320                return;
321            case "body":
322                $this->setBody( $value );
323                return;
324            case "onreadystatechange":
325                $this->setOnreadystatechange( $value );
326                return;
327            case "onvisibilitychange":
328                $this->setOnvisibilitychange( $value );
329                return;
330            case "encoding":
331                $this->setEncoding( $value );
332                return;
333            case "preserveWhiteSpace":
334                $this->setPreserveWhiteSpace( $value );
335                return;
336            case "formatOutput":
337                $this->setFormatOutput( $value );
338                return;
339            case "validateOnParse":
340                $this->setValidateOnParse( $value );
341                return;
342            case "strictErrorChecking":
343                $this->setStrictErrorChecking( $value );
344                return;
345            default:
346                break;
347        }
348        '@phan-var \Wikimedia\IDLeDOM\Helper\Document $this';
349        // @var \Wikimedia\IDLeDOM\Helper\Document $this
350        $this->_setMissingProp( $name, $value );
351    }
352
353    /**
354     * @param string $name
355     */
356    public function __unset( string $name ): void {
357        '@phan-var \Wikimedia\IDLeDOM\Document $this';
358        // @var \Wikimedia\IDLeDOM\Document $this
359        switch ( $name ) {
360            case "nodeType":
361                break;
362            case "nodeName":
363                break;
364            case "baseURI":
365                break;
366            case "isConnected":
367                break;
368            case "ownerDocument":
369                break;
370            case "parentNode":
371                break;
372            case "parentElement":
373                break;
374            case "childNodes":
375                break;
376            case "firstChild":
377                break;
378            case "lastChild":
379                break;
380            case "previousSibling":
381                break;
382            case "nextSibling":
383                break;
384            case "nodeValue":
385                $this->setNodeValue( null );
386                return;
387            case "textContent":
388                $this->setTextContent( null );
389                return;
390            case "styleSheets":
391                break;
392            case "onload":
393                break;
394            case "children":
395                break;
396            case "firstElementChild":
397                break;
398            case "lastElementChild":
399                break;
400            case "childElementCount":
401                break;
402            case "implementation":
403                break;
404            case "URL":
405                break;
406            case "documentURI":
407                break;
408            case "compatMode":
409                break;
410            case "characterSet":
411                break;
412            case "charset":
413                break;
414            case "inputEncoding":
415                break;
416            case "contentType":
417                break;
418            case "doctype":
419                break;
420            case "documentElement":
421                break;
422            case "location":
423                break;
424            case "referrer":
425                break;
426            case "cookie":
427                break;
428            case "lastModified":
429                break;
430            case "title":
431                break;
432            case "dir":
433                break;
434            case "body":
435                $this->setBody( null );
436                return;
437            case "head":
438                break;
439            case "images":
440                break;
441            case "embeds":
442                break;
443            case "plugins":
444                break;
445            case "links":
446                break;
447            case "forms":
448                break;
449            case "scripts":
450                break;
451            case "currentScript":
452                break;
453            case "onreadystatechange":
454                break;
455            case "anchors":
456                break;
457            case "applets":
458                break;
459            case "hidden":
460                break;
461            case "visibilityState":
462                break;
463            case "onvisibilitychange":
464                break;
465            case "encoding":
466                break;
467            case "preserveWhiteSpace":
468                break;
469            case "formatOutput":
470                break;
471            case "validateOnParse":
472                break;
473            case "strictErrorChecking":
474                break;
475            default:
476                return;
477        }
478        $trace = debug_backtrace();
479        while (
480            count( $trace ) > 0 &&
481            $trace[0]['function'] !== "__unset"
482        ) {
483            array_shift( $trace );
484        }
485        trigger_error(
486            'Undefined property' .
487            ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
488            ' in ' . ( $trace[0]['file'] ?? '' ) .
489            ' on line ' . ( $trace[0]['line'] ?? '' ),
490            E_USER_NOTICE
491        );
492    }
493
494    /**
495     * @param string $val
496     */
497    public function setLocation( string $val ): void {
498        '@phan-var \Wikimedia\IDLeDOM\Document $this';
499        // @var \Wikimedia\IDLeDOM\Document $this
500        $this->getLocation()->setHref( $val );
501    }
502
503}