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