Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 144
0.00% covered (danger)
0.00%
0 / 7
CRAP
0.00% covered (danger)
0.00%
0 / 1
URL
0.00% covered (danger)
0.00%
0 / 144
0.00% covered (danger)
0.00%
0 / 7
4032
0.00% covered (danger)
0.00%
0 / 1
 _getMissingProp
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
12
 _setMissingProp
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
12
 __get
0.00% covered (danger)
0.00%
0 / 26
0.00% covered (danger)
0.00%
0 / 1
210
 __isset
0.00% covered (danger)
0.00%
0 / 26
0.00% covered (danger)
0.00%
0 / 1
210
 __set
0.00% covered (danger)
0.00%
0 / 32
0.00% covered (danger)
0.00%
0 / 1
156
 __unset
0.00% covered (danger)
0.00%
0 / 36
0.00% covered (danger)
0.00%
0 / 1
272
 __toString
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3// AUTOMATICALLY GENERATED.  DO NOT EDIT.
4// Use `composer build` to regenerate.
5
6namespace Wikimedia\IDLeDOM\Helper;
7
8trait URL {
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\URL $this';
75        // @var \Wikimedia\IDLeDOM\URL $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 "username":
84                return $this->getUsername();
85            case "password":
86                return $this->getPassword();
87            case "host":
88                return $this->getHost();
89            case "hostname":
90                return $this->getHostname();
91            case "port":
92                return $this->getPort();
93            case "pathname":
94                return $this->getPathname();
95            case "search":
96                return $this->getSearch();
97            case "searchParams":
98                return $this->getSearchParams();
99            case "hash":
100                return $this->getHash();
101            default:
102                break;
103        }
104        '@phan-var \Wikimedia\IDLeDOM\Helper\URL $this';
105        // @var \Wikimedia\IDLeDOM\Helper\URL $this
106        return $this->_getMissingProp( $name );
107    }
108
109    /**
110     * @param string $name
111     * @return bool
112     */
113    public function __isset( string $name ): bool {
114        '@phan-var \Wikimedia\IDLeDOM\URL $this';
115        // @var \Wikimedia\IDLeDOM\URL $this
116        switch ( $name ) {
117            case "href":
118                return true;
119            case "origin":
120                return true;
121            case "protocol":
122                return true;
123            case "username":
124                return true;
125            case "password":
126                return true;
127            case "host":
128                return true;
129            case "hostname":
130                return true;
131            case "port":
132                return true;
133            case "pathname":
134                return true;
135            case "search":
136                return true;
137            case "searchParams":
138                return true;
139            case "hash":
140                return true;
141            default:
142                break;
143        }
144        return false;
145    }
146
147    /**
148     * @param string $name
149     * @param mixed $value
150     */
151    public function __set( string $name, $value ): void {
152        '@phan-var \Wikimedia\IDLeDOM\URL $this';
153        // @var \Wikimedia\IDLeDOM\URL $this
154        switch ( $name ) {
155            case "href":
156                $this->setHref( $value );
157                return;
158            case "protocol":
159                $this->setProtocol( $value );
160                return;
161            case "username":
162                $this->setUsername( $value );
163                return;
164            case "password":
165                $this->setPassword( $value );
166                return;
167            case "host":
168                $this->setHost( $value );
169                return;
170            case "hostname":
171                $this->setHostname( $value );
172                return;
173            case "port":
174                $this->setPort( $value );
175                return;
176            case "pathname":
177                $this->setPathname( $value );
178                return;
179            case "search":
180                $this->setSearch( $value );
181                return;
182            case "hash":
183                $this->setHash( $value );
184                return;
185            default:
186                break;
187        }
188        '@phan-var \Wikimedia\IDLeDOM\Helper\URL $this';
189        // @var \Wikimedia\IDLeDOM\Helper\URL $this
190        $this->_setMissingProp( $name, $value );
191    }
192
193    /**
194     * @param string $name
195     */
196    public function __unset( string $name ): void {
197        '@phan-var \Wikimedia\IDLeDOM\URL $this';
198        // @var \Wikimedia\IDLeDOM\URL $this
199        switch ( $name ) {
200            case "href":
201                break;
202            case "origin":
203                break;
204            case "protocol":
205                break;
206            case "username":
207                break;
208            case "password":
209                break;
210            case "host":
211                break;
212            case "hostname":
213                break;
214            case "port":
215                break;
216            case "pathname":
217                break;
218            case "search":
219                break;
220            case "searchParams":
221                break;
222            case "hash":
223                break;
224            default:
225                return;
226        }
227        $trace = debug_backtrace();
228        while (
229            count( $trace ) > 0 &&
230            $trace[0]['function'] !== "__unset"
231        ) {
232            array_shift( $trace );
233        }
234        trigger_error(
235            'Undefined property' .
236            ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
237            ' in ' . ( $trace[0]['file'] ?? '' ) .
238            ' on line ' . ( $trace[0]['line'] ?? '' ),
239            E_USER_NOTICE
240        );
241    }
242
243    /**
244     * @return string
245     */
246    public function __toString(): string {
247        '@phan-var \Wikimedia\IDLeDOM\URL $this';
248        // @var \Wikimedia\IDLeDOM\URL $this
249        return $this->getHref();
250    }
251
252}