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