Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/Window.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 Window {
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\Window $this';
44 // @var \Wikimedia\IDLeDOM\Window $this
45 switch ( $name ) {
46 case "onload":
47 return $this->getOnload();
48 case "document":
49 return $this->getDocument();
50 case "name":
51 return $this->getName();
52 case "location":
53 return $this->getLocation();
54 case "status":
55 return $this->getStatus();
56 case "closed":
57 return $this->getClosed();
58 case "length":
59 return $this->getLength();
60 case "opener":
61 return $this->getOpener();
62 case "frameElement":
63 return $this->getFrameElement();
64 case "navigator":
65 return $this->getNavigator();
66 case "originAgentCluster":
67 return $this->getOriginAgentCluster();
68 case "event":
69 return $this->getEvent();
70 default:
71 break;
72 }
73 '@phan-var \Wikimedia\IDLeDOM\Helper\Window $this';
74 // @var \Wikimedia\IDLeDOM\Helper\Window $this
75 return $this->_getMissingProp( $name );
76 }
77
78 /**
79 * @param string $name
80 * @return bool
81 */
82 public function __isset( string $name ): bool {
83 '@phan-var \Wikimedia\IDLeDOM\Window $this';
84 // @var \Wikimedia\IDLeDOM\Window $this
85 switch ( $name ) {
86 case "onload":
87 return true;
88 case "document":
89 return true;
90 case "name":
91 return true;
92 case "location":
93 return true;
94 case "status":
95 return true;
96 case "closed":
97 return true;
98 case "length":
99 return true;
100 case "opener":
101 return true;
102 case "frameElement":
103 return $this->getFrameElement() !== null;
104 case "navigator":
105 return true;
106 case "originAgentCluster":
107 return true;
108 case "event":
109 return true;
110 default:
111 break;
112 }
113 return false;
114 }
115
116 /**
117 * @param string $name
118 * @param mixed $value
119 */
120 public function __set( string $name, $value ): void {
121 '@phan-var \Wikimedia\IDLeDOM\Window $this';
122 // @var \Wikimedia\IDLeDOM\Window $this
123 switch ( $name ) {
124 case "onload":
125 $this->setOnload( $value );
126 return;
127 case "name":
128 $this->setName( $value );
129 return;
130 case "location":
131 $this->setLocation( $value );
132 return;
133 case "status":
134 $this->setStatus( $value );
135 return;
136 case "opener":
137 $this->setOpener( $value );
138 return;
139 default:
140 break;
141 }
142 '@phan-var \Wikimedia\IDLeDOM\Helper\Window $this';
143 // @var \Wikimedia\IDLeDOM\Helper\Window $this
144 $this->_setMissingProp( $name, $value );
145 }
146
147 /**
148 * @param string $name
149 */
150 public function __unset( string $name ): void {
151 '@phan-var \Wikimedia\IDLeDOM\Window $this';
152 // @var \Wikimedia\IDLeDOM\Window $this
153 switch ( $name ) {
154 case "onload":
155 break;
156 case "document":
157 break;
158 case "name":
159 break;
160 case "location":
161 break;
162 case "status":
163 break;
164 case "closed":
165 break;
166 case "length":
167 break;
168 case "opener":
169 break;
170 case "frameElement":
171 break;
172 case "navigator":
173 break;
174 case "originAgentCluster":
175 break;
176 case "event":
177 break;
178 default:
179 return;
180 }
181 $trace = debug_backtrace();
182 while (
183 count( $trace ) > 0 &&
184 $trace[0]['function'] !== "__unset"
185 ) {
186 array_shift( $trace );
187 }
188 trigger_error(
189 'Undefined property' .
190 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
191 ' in ' . ( $trace[0]['file'] ?? '' ) .
192 ' on line ' . ( $trace[0]['line'] ?? '' ),
193 E_USER_NOTICE
194 );
195 }
196
197 /**
198 * @param string $val
199 */
200 public function setLocation( string $val ): void {
201 '@phan-var \Wikimedia\IDLeDOM\Window $this';
202 // @var \Wikimedia\IDLeDOM\Window $this
203 $this->getLocation()->setHref( $val );
204 }
205
206 }