Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/Text.php

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