Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 128
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
DocumentType
0.00% covered (danger)
0.00%
0 / 128
0.00% covered (danger)
0.00%
0 / 4
4032
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 / 36
0.00% covered (danger)
0.00%
0 / 1
380
 __isset
0.00% covered (danger)
0.00%
0 / 36
0.00% covered (danger)
0.00%
0 / 1
380
 __set
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
20
 __unset
0.00% covered (danger)
0.00%
0 / 48
0.00% covered (danger)
0.00%
0 / 1
462
1<?php
2
3// AUTOMATICALLY GENERATED.  DO NOT EDIT.
4// Use `composer build` to regenerate.
5
6namespace Wikimedia\IDLeDOM\Helper;
7
8trait DocumentType {
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\DocumentType $this';
44        // @var \Wikimedia\IDLeDOM\DocumentType $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 "name":
75                return $this->getName();
76            case "publicId":
77                return $this->getPublicId();
78            case "systemId":
79                return $this->getSystemId();
80            default:
81                break;
82        }
83        '@phan-var \Wikimedia\IDLeDOM\Helper\DocumentType $this';
84        // @var \Wikimedia\IDLeDOM\Helper\DocumentType $this
85        return $this->_getMissingProp( $name );
86    }
87
88    /**
89     * @param string $name
90     * @return bool
91     */
92    public function __isset( string $name ): bool {
93        '@phan-var \Wikimedia\IDLeDOM\DocumentType $this';
94        // @var \Wikimedia\IDLeDOM\DocumentType $this
95        switch ( $name ) {
96            case "nodeType":
97                return true;
98            case "nodeName":
99                return true;
100            case "baseURI":
101                return true;
102            case "isConnected":
103                return true;
104            case "ownerDocument":
105                return $this->getOwnerDocument() !== null;
106            case "parentNode":
107                return $this->getParentNode() !== null;
108            case "parentElement":
109                return $this->getParentElement() !== null;
110            case "childNodes":
111                return true;
112            case "firstChild":
113                return $this->getFirstChild() !== null;
114            case "lastChild":
115                return $this->getLastChild() !== null;
116            case "previousSibling":
117                return $this->getPreviousSibling() !== null;
118            case "nextSibling":
119                return $this->getNextSibling() !== null;
120            case "nodeValue":
121                return $this->getNodeValue() !== null;
122            case "textContent":
123                return $this->getTextContent() !== null;
124            case "name":
125                return true;
126            case "publicId":
127                return true;
128            case "systemId":
129                return true;
130            default:
131                break;
132        }
133        return false;
134    }
135
136    /**
137     * @param string $name
138     * @param mixed $value
139     */
140    public function __set( string $name, $value ): void {
141        '@phan-var \Wikimedia\IDLeDOM\DocumentType $this';
142        // @var \Wikimedia\IDLeDOM\DocumentType $this
143        switch ( $name ) {
144            case "nodeValue":
145                $this->setNodeValue( $value );
146                return;
147            case "textContent":
148                $this->setTextContent( $value );
149                return;
150            default:
151                break;
152        }
153        '@phan-var \Wikimedia\IDLeDOM\Helper\DocumentType $this';
154        // @var \Wikimedia\IDLeDOM\Helper\DocumentType $this
155        $this->_setMissingProp( $name, $value );
156    }
157
158    /**
159     * @param string $name
160     */
161    public function __unset( string $name ): void {
162        '@phan-var \Wikimedia\IDLeDOM\DocumentType $this';
163        // @var \Wikimedia\IDLeDOM\DocumentType $this
164        switch ( $name ) {
165            case "nodeType":
166                break;
167            case "nodeName":
168                break;
169            case "baseURI":
170                break;
171            case "isConnected":
172                break;
173            case "ownerDocument":
174                break;
175            case "parentNode":
176                break;
177            case "parentElement":
178                break;
179            case "childNodes":
180                break;
181            case "firstChild":
182                break;
183            case "lastChild":
184                break;
185            case "previousSibling":
186                break;
187            case "nextSibling":
188                break;
189            case "nodeValue":
190                $this->setNodeValue( null );
191                return;
192            case "textContent":
193                $this->setTextContent( null );
194                return;
195            case "name":
196                break;
197            case "publicId":
198                break;
199            case "systemId":
200                break;
201            default:
202                return;
203        }
204        $trace = debug_backtrace();
205        while (
206            count( $trace ) > 0 &&
207            $trace[0]['function'] !== "__unset"
208        ) {
209            array_shift( $trace );
210        }
211        trigger_error(
212            'Undefined property' .
213            ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
214            ' in ' . ( $trace[0]['file'] ?? '' ) .
215            ' on line ' . ( $trace[0]['line'] ?? '' ),
216            E_USER_NOTICE
217        );
218    }
219
220}