Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/DocumentFragment.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 DocumentFragment {
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\DocumentFragment $this';
44 // @var \Wikimedia\IDLeDOM\DocumentFragment $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 "children":
75 return $this->getChildren();
76 case "firstElementChild":
77 return $this->getFirstElementChild();
78 case "lastElementChild":
79 return $this->getLastElementChild();
80 case "childElementCount":
81 return $this->getChildElementCount();
82 default:
83 break;
84 }
85 '@phan-var \Wikimedia\IDLeDOM\Helper\DocumentFragment $this';
86 // @var \Wikimedia\IDLeDOM\Helper\DocumentFragment $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\DocumentFragment $this';
96 // @var \Wikimedia\IDLeDOM\DocumentFragment $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 "children":
127 return true;
128 case "firstElementChild":
129 return $this->getFirstElementChild() !== null;
130 case "lastElementChild":
131 return $this->getLastElementChild() !== null;
132 case "childElementCount":
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\DocumentFragment $this';
146 // @var \Wikimedia\IDLeDOM\DocumentFragment $this
147 switch ( $name ) {
148 case "nodeValue":
149 $this->setNodeValue( $value );
150 return;
151 case "textContent":
152 $this->setTextContent( $value );
153 return;
154 default:
155 break;
156 }
157 '@phan-var \Wikimedia\IDLeDOM\Helper\DocumentFragment $this';
158 // @var \Wikimedia\IDLeDOM\Helper\DocumentFragment $this
159 $this->_setMissingProp( $name, $value );
160 }
161
162 /**
163 * @param string $name
164 */
165 public function __unset( string $name ): void {
166 '@phan-var \Wikimedia\IDLeDOM\DocumentFragment $this';
167 // @var \Wikimedia\IDLeDOM\DocumentFragment $this
168 switch ( $name ) {
169 case "nodeType":
170 break;
171 case "nodeName":
172 break;
173 case "baseURI":
174 break;
175 case "isConnected":
176 break;
177 case "ownerDocument":
178 break;
179 case "parentNode":
180 break;
181 case "parentElement":
182 break;
183 case "childNodes":
184 break;
185 case "firstChild":
186 break;
187 case "lastChild":
188 break;
189 case "previousSibling":
190 break;
191 case "nextSibling":
192 break;
193 case "nodeValue":
194 $this->setNodeValue( null );
195 return;
196 case "textContent":
197 $this->setTextContent( null );
198 return;
199 case "children":
200 break;
201 case "firstElementChild":
202 break;
203 case "lastElementChild":
204 break;
205 case "childElementCount":
206 break;
207 default:
208 return;
209 }
210 $trace = debug_backtrace();
211 while (
212 count( $trace ) > 0 &&
213 $trace[0]['function'] !== "__unset"
214 ) {
215 array_shift( $trace );
216 }
217 trigger_error(
218 'Undefined property' .
219 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
220 ' in ' . ( $trace[0]['file'] ?? '' ) .
221 ' on line ' . ( $trace[0]['line'] ?? '' ),
222 E_USER_NOTICE
223 );
224 }
225
226 }