Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/Node.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 Node {
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\Node $this';
44 // @var \Wikimedia\IDLeDOM\Node $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 default:
75 break;
76 }
77 '@phan-var \Wikimedia\IDLeDOM\Helper\Node $this';
78 // @var \Wikimedia\IDLeDOM\Helper\Node $this
79 return $this->_getMissingProp( $name );
80 }
81
82 /**
83 * @param string $name
84 * @return bool
85 */
86 public function __isset( string $name ): bool {
87 '@phan-var \Wikimedia\IDLeDOM\Node $this';
88 // @var \Wikimedia\IDLeDOM\Node $this
89 switch ( $name ) {
90 case "nodeType":
91 return true;
92 case "nodeName":
93 return true;
94 case "baseURI":
95 return true;
96 case "isConnected":
97 return true;
98 case "ownerDocument":
99 return $this->getOwnerDocument() !== null;
100 case "parentNode":
101 return $this->getParentNode() !== null;
102 case "parentElement":
103 return $this->getParentElement() !== null;
104 case "childNodes":
105 return true;
106 case "firstChild":
107 return $this->getFirstChild() !== null;
108 case "lastChild":
109 return $this->getLastChild() !== null;
110 case "previousSibling":
111 return $this->getPreviousSibling() !== null;
112 case "nextSibling":
113 return $this->getNextSibling() !== null;
114 case "nodeValue":
115 return $this->getNodeValue() !== null;
116 case "textContent":
117 return $this->getTextContent() !== null;
118 default:
119 break;
120 }
121 return false;
122 }
123
124 /**
125 * @param string $name
126 * @param mixed $value
127 */
128 public function __set( string $name, $value ): void {
129 '@phan-var \Wikimedia\IDLeDOM\Node $this';
130 // @var \Wikimedia\IDLeDOM\Node $this
131 switch ( $name ) {
132 case "nodeValue":
133 $this->setNodeValue( $value );
134 return;
135 case "textContent":
136 $this->setTextContent( $value );
137 return;
138 default:
139 break;
140 }
141 '@phan-var \Wikimedia\IDLeDOM\Helper\Node $this';
142 // @var \Wikimedia\IDLeDOM\Helper\Node $this
143 $this->_setMissingProp( $name, $value );
144 }
145
146 /**
147 * @param string $name
148 */
149 public function __unset( string $name ): void {
150 '@phan-var \Wikimedia\IDLeDOM\Node $this';
151 // @var \Wikimedia\IDLeDOM\Node $this
152 switch ( $name ) {
153 case "nodeType":
154 break;
155 case "nodeName":
156 break;
157 case "baseURI":
158 break;
159 case "isConnected":
160 break;
161 case "ownerDocument":
162 break;
163 case "parentNode":
164 break;
165 case "parentElement":
166 break;
167 case "childNodes":
168 break;
169 case "firstChild":
170 break;
171 case "lastChild":
172 break;
173 case "previousSibling":
174 break;
175 case "nextSibling":
176 break;
177 case "nodeValue":
178 $this->setNodeValue( null );
179 return;
180 case "textContent":
181 $this->setTextContent( null );
182 return;
183 default:
184 return;
185 }
186 $trace = debug_backtrace();
187 while (
188 count( $trace ) > 0 &&
189 $trace[0]['function'] !== "__unset"
190 ) {
191 array_shift( $trace );
192 }
193 trigger_error(
194 'Undefined property' .
195 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
196 ' in ' . ( $trace[0]['file'] ?? '' ) .
197 ' on line ' . ( $trace[0]['line'] ?? '' ),
198 E_USER_NOTICE
199 );
200 }
201
202 }