1 | <?php |
||
29 | class Application extends \yii\base\Application |
||
30 | { |
||
31 | /** |
||
32 | * @var string the default route of this application. Defaults to 'site'. |
||
33 | */ |
||
34 | public $defaultRoute = 'site'; |
||
35 | /** |
||
36 | * @var array the configuration specifying a controller action which should handle |
||
37 | * all user requests. This is mainly used when the application is in maintenance mode |
||
38 | * and needs to handle all incoming requests via a single action. |
||
39 | * The configuration is an array whose first element specifies the route of the action. |
||
40 | * The rest of the array elements (key-value pairs) specify the parameters to be bound |
||
41 | * to the action. For example, |
||
42 | * |
||
43 | * ```php |
||
44 | * [ |
||
45 | * 'offline/notice', |
||
46 | * 'param1' => 'value1', |
||
47 | * 'param2' => 'value2', |
||
48 | * ] |
||
49 | * ``` |
||
50 | * |
||
51 | * Defaults to null, meaning catch-all is not used. |
||
52 | */ |
||
53 | public $catchAll; |
||
54 | /** |
||
55 | * @var Controller the currently active controller instance |
||
56 | */ |
||
57 | public $controller; |
||
58 | |||
59 | |||
60 | /** |
||
61 | * @inheritdoc |
||
62 | */ |
||
63 | 144 | protected function bootstrap() |
|
71 | |||
72 | /** |
||
73 | * Handles the specified request. |
||
74 | * @param Request $request the request to be handled |
||
75 | * @return Response the resulting response |
||
76 | * @throws NotFoundHttpException if the requested route is invalid |
||
77 | */ |
||
78 | public function handleRequest($request) |
||
117 | |||
118 | private $_homeUrl; |
||
119 | |||
120 | /** |
||
121 | * @return string the homepage URL |
||
122 | */ |
||
123 | 3 | public function getHomeUrl() |
|
135 | |||
136 | /** |
||
137 | * @param string $value the homepage URL |
||
138 | */ |
||
139 | public function setHomeUrl($value) |
||
143 | |||
144 | /** |
||
145 | * Returns the error handler component. |
||
146 | * @return ErrorHandler the error handler application component. |
||
147 | */ |
||
148 | 3 | public function getErrorHandler() |
|
149 | { |
||
150 | 3 | return $this->get('errorHandler'); |
|
151 | } |
||
152 | |||
153 | /** |
||
154 | * Returns the request component. |
||
155 | * @return Request the request component. |
||
156 | */ |
||
157 | 144 | public function getRequest() |
|
161 | |||
162 | /** |
||
163 | * Returns the response component. |
||
164 | * @return Response the response component. |
||
165 | */ |
||
166 | 68 | public function getResponse() |
|
170 | |||
171 | /** |
||
172 | * Returns the session component. |
||
173 | * @return Session the session component. |
||
174 | */ |
||
175 | 26 | public function getSession() |
|
179 | |||
180 | /** |
||
181 | * Returns the user component. |
||
182 | * @return User the user component. |
||
183 | */ |
||
184 | 24 | public function getUser() |
|
188 | |||
189 | /** |
||
190 | * @inheritdoc |
||
191 | */ |
||
192 | 144 | public function coreComponents() |
|
202 | } |
||
203 |