1 | <?php |
||
10 | class AppManager |
||
11 | { |
||
12 | use Macroable; |
||
13 | |||
14 | /** |
||
15 | * The container instance. |
||
16 | * |
||
17 | * @var \Illuminate\Contracts\Container\Container |
||
18 | */ |
||
19 | protected $container; |
||
20 | |||
21 | /** |
||
22 | * The current application identifier. |
||
23 | * |
||
24 | * @var string|false |
||
25 | */ |
||
26 | protected $id = false; |
||
27 | |||
28 | /** |
||
29 | * Create a new app manager instance. |
||
30 | * |
||
31 | * @param \Illuminate\Contracts\Container\Container $container |
||
32 | */ |
||
33 | 11 | public function __construct(Container $container) |
|
41 | |||
42 | /** |
||
43 | * Get or check the current application identifier. |
||
44 | * |
||
45 | * @return string|bool |
||
46 | */ |
||
47 | 3 | public function id() |
|
59 | |||
60 | /** |
||
61 | * Refresh the current application identifier. |
||
62 | * |
||
63 | * @return $this |
||
64 | */ |
||
65 | 2 | public function refreshId() |
|
71 | |||
72 | /** |
||
73 | * Get application identifier for the given URL. |
||
74 | * |
||
75 | * @param string $url |
||
76 | * @return string |
||
77 | */ |
||
78 | 4 | public function idForUrl($url) |
|
90 | |||
91 | /** |
||
92 | * Determine if an URL has the given root URL. |
||
93 | * |
||
94 | * @param string $url |
||
95 | * @param string $root |
||
96 | * @param bool $strict |
||
97 | * @return bool |
||
98 | */ |
||
99 | 4 | protected function urlHasRoot($url, $root, $strict = false) |
|
108 | |||
109 | /** |
||
110 | * Remove scheme for an URL. |
||
111 | * |
||
112 | * @param string $url |
||
113 | * @return string |
||
114 | */ |
||
115 | 4 | protected function removeScheme($url) |
|
119 | |||
120 | /** |
||
121 | * Get all application URLs. |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | public function appUrls() |
||
129 | |||
130 | /** |
||
131 | * Get the root URL for the given application. |
||
132 | * |
||
133 | * @param string $app |
||
134 | * @return mixed |
||
135 | */ |
||
136 | public function appUrl($app = '') |
||
141 | |||
142 | /** |
||
143 | * Get the root URL for the given application identifier. |
||
144 | * |
||
145 | * @param string $appId |
||
146 | * @return string |
||
147 | */ |
||
148 | 4 | public function root($appId = '') |
|
153 | |||
154 | /** |
||
155 | * Get the domain for the given application identifier. |
||
156 | * |
||
157 | * @param string $appId |
||
158 | * @return string |
||
159 | */ |
||
160 | 1 | public function domain($appId = '') |
|
164 | |||
165 | /** |
||
166 | * Get the URL prefix for the given application identifier. |
||
167 | * |
||
168 | * @param string $appId |
||
169 | * @return string |
||
170 | */ |
||
171 | 1 | public function prefix($appId = '') |
|
175 | |||
176 | /** |
||
177 | * Generate an absolute URL to a path for the given application identifier. |
||
178 | * |
||
179 | * @param string $appId |
||
180 | * @param string $path |
||
181 | * @param mixed $extra |
||
182 | * @return string |
||
183 | */ |
||
184 | 1 | public function url($appId = '', $path = '', $extra = []) |
|
191 | |||
192 | /** |
||
193 | * Return the remainder of a string after a given value. |
||
194 | * |
||
195 | * @param string $subject |
||
196 | * @param string $search |
||
197 | * @return string |
||
198 | */ |
||
199 | 1 | protected function stringAfter($subject, $search) |
|
203 | |||
204 | /** |
||
205 | * Register routes for each sub application. |
||
206 | * |
||
207 | * @param array $attributes |
||
208 | * @return void |
||
209 | */ |
||
210 | public function routes(array $attributes = []) |
||
225 | |||
226 | /** |
||
227 | * Get route group attributes for the given application identifier. |
||
228 | * |
||
229 | * @param string $appId |
||
230 | * @param array $attributes |
||
231 | * @return array |
||
232 | */ |
||
233 | protected function getRouteGroupAttributes($appId, array $attributes = []) |
||
247 | |||
248 | /** |
||
249 | * Get the root controller namespace. |
||
250 | * |
||
251 | * @return string |
||
252 | */ |
||
253 | protected function getRootControllerNamespace() |
||
261 | |||
262 | /** |
||
263 | * Register macros. |
||
264 | * |
||
265 | * @param \Illuminate\Contracts\Container\Container $app |
||
266 | * @return void |
||
267 | */ |
||
268 | public static function registerMacros($app) |
||
275 | } |
||
276 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: