Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/Location.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 Location {
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 protected function _getMissingProp( string $prop ) {
24 $trace = debug_backtrace();
25 while (
26 count( $trace ) > 0 &&
27 $trace[0]['function'] !== "__get"
28 ) {
29 array_shift( $trace );
30 }
31 trigger_error(
32 'Undefined property' .
33 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop .
34 ' in ' . ( $trace[0]['file'] ?? '' ) .
35 ' on line ' . ( $trace[0]['line'] ?? '' ),
36 E_USER_NOTICE
37 );
38 return null;
39 }
40
41 /**
42 * Handle an attempt to set a non-existing property on this
43 * object. The default implementation raises an exception
44 * but the implementor can choose a different behavior:
45 * ignore the operation (like JavaScript), dynamically create
46 * the property, etc.
47 * @param string $prop the name of the property requested
48 * @param mixed $value the value to set
49 */
50 protected function _setMissingProp( string $prop, $value ): void {
51 $trace = debug_backtrace();
52 while (
53 count( $trace ) > 0 &&
54 $trace[0]['function'] !== "__set"
55 ) {
56 array_shift( $trace );
57 }
58 trigger_error(
59 'Undefined property' .
60 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop .
61 ' in ' . ( $trace[0]['file'] ?? '' ) .
62 ' on line ' . ( $trace[0]['line'] ?? '' ),
63 E_USER_NOTICE
64 );
65 }
66
67 // phpcs:enable
68
69 /**
70 * @param string $name
71 * @return mixed
72 */
73 public function __get( string $name ) {
74 '@phan-var \Wikimedia\IDLeDOM\Location $this';
75 // @var \Wikimedia\IDLeDOM\Location $this
76 switch ( $name ) {
77 case "href":
78 return $this->getHref();
79 case "origin":
80 return $this->getOrigin();
81 case "protocol":
82 return $this->getProtocol();
83 case "host":
84 return $this->getHost();
85 case "hostname":
86 return $this->getHostname();
87 case "port":
88 return $this->getPort();
89 case "pathname":
90 return $this->getPathname();
91 case "search":
92 return $this->getSearch();
93 case "hash":
94 return $this->getHash();
95 default:
96 break;
97 }
98 '@phan-var \Wikimedia\IDLeDOM\Helper\Location $this';
99 // @var \Wikimedia\IDLeDOM\Helper\Location $this
100 return $this->_getMissingProp( $name );
101 }
102
103 /**
104 * @param string $name
105 * @return bool
106 */
107 public function __isset( string $name ): bool {
108 '@phan-var \Wikimedia\IDLeDOM\Location $this';
109 // @var \Wikimedia\IDLeDOM\Location $this
110 switch ( $name ) {
111 case "href":
112 return true;
113 case "origin":
114 return true;
115 case "protocol":
116 return true;
117 case "host":
118 return true;
119 case "hostname":
120 return true;
121 case "port":
122 return true;
123 case "pathname":
124 return true;
125 case "search":
126 return true;
127 case "hash":
128 return true;
129 default:
130 break;
131 }
132 return false;
133 }
134
135 /**
136 * @param string $name
137 * @param mixed $value
138 */
139 public function __set( string $name, $value ): void {
140 '@phan-var \Wikimedia\IDLeDOM\Location $this';
141 // @var \Wikimedia\IDLeDOM\Location $this
142 switch ( $name ) {
143 case "href":
144 $this->setHref( $value );
145 return;
146 case "protocol":
147 $this->setProtocol( $value );
148 return;
149 case "host":
150 $this->setHost( $value );
151 return;
152 case "hostname":
153 $this->setHostname( $value );
154 return;
155 case "port":
156 $this->setPort( $value );
157 return;
158 case "pathname":
159 $this->setPathname( $value );
160 return;
161 case "search":
162 $this->setSearch( $value );
163 return;
164 case "hash":
165 $this->setHash( $value );
166 return;
167 default:
168 break;
169 }
170 '@phan-var \Wikimedia\IDLeDOM\Helper\Location $this';
171 // @var \Wikimedia\IDLeDOM\Helper\Location $this
172 $this->_setMissingProp( $name, $value );
173 }
174
175 /**
176 * @param string $name
177 */
178 public function __unset( string $name ): void {
179 '@phan-var \Wikimedia\IDLeDOM\Location $this';
180 // @var \Wikimedia\IDLeDOM\Location $this
181 switch ( $name ) {
182 case "href":
183 break;
184 case "origin":
185 break;
186 case "protocol":
187 break;
188 case "host":
189 break;
190 case "hostname":
191 break;
192 case "port":
193 break;
194 case "pathname":
195 break;
196 case "search":
197 break;
198 case "hash":
199 break;
200 default:
201 return;
202 }
203 $trace = debug_backtrace();
204 while (
205 count( $trace ) > 0 &&
206 $trace[0]['function'] !== "__unset"
207 ) {
208 array_shift( $trace );
209 }
210 trigger_error(
211 'Undefined property' .
212 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
213 ' in ' . ( $trace[0]['file'] ?? '' ) .
214 ' on line ' . ( $trace[0]['line'] ?? '' ),
215 E_USER_NOTICE
216 );
217 }
218
219 /**
220 * @return string
221 */
222 public function __toString(): string {
223 '@phan-var \Wikimedia\IDLeDOM\Location $this';
224 // @var \Wikimedia\IDLeDOM\Location $this
225 return $this->getHref();
226 }
227
228 }