1 | <?php |
||
5 | class Url |
||
6 | { |
||
7 | /** |
||
8 | * Protocol |
||
9 | * |
||
10 | * @var string |
||
11 | */ |
||
12 | private $protocol; |
||
13 | |||
14 | /** |
||
15 | * Host |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | private $host; |
||
20 | |||
21 | /** |
||
22 | * Parameters |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | private $parameters; |
||
27 | |||
28 | /** |
||
29 | * Base Url |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | private $baseUrl; |
||
34 | |||
35 | /** |
||
36 | * Application Object |
||
37 | * |
||
38 | * @var \System\Application |
||
39 | */ |
||
40 | private $app; |
||
41 | |||
42 | /** |
||
43 | * Constructor |
||
44 | * |
||
45 | * @param \System\Application $app |
||
46 | */ |
||
47 | public function __construct(Application $app) |
||
53 | |||
54 | /** |
||
55 | * Prepare url |
||
56 | * |
||
57 | * @property object $request |
||
58 | * @property object $http |
||
59 | * @return void |
||
60 | */ |
||
61 | private function prepare() |
||
81 | |||
82 | /** |
||
83 | * Get Protocol |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | public function protocol() |
||
91 | |||
92 | /** |
||
93 | * Get Root domain |
||
94 | * |
||
95 | * @return string |
||
96 | */ |
||
97 | public function rootDomain() |
||
101 | |||
102 | /** |
||
103 | * Get parameters |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | public function parameters() |
||
111 | |||
112 | /** |
||
113 | * Get only host |
||
114 | * |
||
115 | * @return string |
||
116 | */ |
||
117 | public function host() |
||
121 | |||
122 | /** |
||
123 | * Get full url of the script |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | public function baseUrl() |
||
131 | |||
132 | /** |
||
133 | * Generate full link for the given path |
||
134 | * |
||
135 | * @param string $path |
||
136 | * @return string |
||
137 | */ |
||
138 | public function link(string $path) |
||
147 | |||
148 | /** |
||
149 | * Redirect to the given path |
||
150 | * |
||
151 | * @param string $path |
||
152 | * @param int $num |
||
153 | * @return void |
||
154 | */ |
||
155 | public function redirectTo(string $path, int $num = 0) |
||
160 | |||
161 | /** |
||
162 | * Redirect to the previous page |
||
163 | * |
||
164 | * @return void |
||
165 | */ |
||
166 | public function redirectToPreviousPage() |
||
171 | |||
172 | /** |
||
173 | * Redirect to the 404 page |
||
174 | * |
||
175 | * @property object $request |
||
176 | * @property object $load |
||
177 | * @param string $path |
||
178 | * @return void |
||
179 | */ |
||
180 | public function notfound(string $path = '') |
||
192 | } |
||
193 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.