1111namespace Bluz \Application ;
1212
1313use Bluz \Application \Exception \ApplicationException ;
14+ use Bluz \Config \ConfigException ;
1415use Bluz \Config \ConfigLoader ;
1516use Bluz \Http \Exception \ForbiddenException ;
16- use Bluz \Http \Exception \NotAcceptableException ;
17- use Bluz \Http \Exception \NotAllowedException ;
1817use Bluz \Http \Exception \RedirectException ;
1918use Bluz \Common ;
2019use Bluz \Common \Exception \CommonException ;
3231use Bluz \Proxy \Translator ;
3332use Bluz \Request \RequestFactory ;
3433use Bluz \Response \Response as ResponseInstance ;
34+ use Exception ;
35+ use InvalidArgumentException ;
36+ use ReflectionClass ;
37+ use ReflectionException ;
3538use Zend \Diactoros \ServerRequest ;
3639
3740/**
4245 * @author Anton Shevchuk
4346 * @created 06.07.11 16:25
4447 *
45- * @method Controller error(\ Exception $exception)
48+ * @method Controller error(Exception $exception)
4649 * @method mixed forbidden(ForbiddenException $exception)
4750 * @method null redirect(RedirectException $url)
4851 */
@@ -85,17 +88,17 @@ public function getEnvironment(): string
8588 * Get path to Application
8689 *
8790 * @return string
88- * @throws \ ReflectionException
91+ * @throws ReflectionException
8992 */
9093 public function getPath (): string
9194 {
9295 if (!$ this ->path ) {
93- if (\ defined ('PATH_APPLICATION ' )) {
96+ if (defined ('PATH_APPLICATION ' )) {
9497 $ this ->path = PATH_APPLICATION ;
9598 } else {
96- $ reflection = new \ ReflectionClass ($ this );
99+ $ reflection = new ReflectionClass ($ this );
97100 // 3 level up
98- $ this ->path = \ dirname ($ reflection ->getFileName (), 3 );
101+ $ this ->path = dirname ($ reflection ->getFileName (), 3 );
99102 }
100103 }
101104 return $ this ->path ;
@@ -120,7 +123,7 @@ public function isDebug(): bool
120123 */
121124 public function useLayout ($ flag = null ): bool
122125 {
123- if (\ is_bool ($ flag )) {
126+ if (is_bool ($ flag )) {
124127 $ this ->layoutFlag = $ flag ;
125128 }
126129
@@ -166,7 +169,7 @@ public function init($environment = 'production'): void
166169
167170 // init Router
168171 $ this ->initRouter ();
169- } catch (\ Exception $ e ) {
172+ } catch (Exception $ e ) {
170173 throw new ApplicationException ("Application can't be loaded: " . $ e ->getMessage ());
171174 }
172175 }
@@ -175,8 +178,8 @@ public function init($environment = 'production'): void
175178 * Initial Request instance
176179 *
177180 * @return void
178- * @throws \Bluz\Config\ ConfigException
179- * @throws \ ReflectionException
181+ * @throws ConfigException
182+ * @throws ReflectionException
180183 */
181184 protected function initConfig (): void
182185 {
@@ -208,7 +211,7 @@ protected function initConfig(): void
208211 * Initial Request instance
209212 *
210213 * @return void
211- * @throws \ InvalidArgumentException
214+ * @throws InvalidArgumentException
212215 */
213216 protected function initRequest (): void
214217 {
@@ -232,7 +235,7 @@ protected function initResponse(): void
232235 /**
233236 * Get Response instance
234237 *
235- * @return \Bluz\Response\Response
238+ * @return ResponseInstance
236239 */
237240 public function getResponse (): ResponseInstance
238241 {
@@ -242,7 +245,7 @@ public function getResponse(): ResponseInstance
242245 /**
243246 * Get Request instance
244247 *
245- * @return \Zend\Diactoros\ ServerRequest
248+ * @return ServerRequest
246249 */
247250 public function getRequest (): ServerRequest
248251 {
@@ -354,7 +357,7 @@ protected function doProcess(): void
354357 } catch (RedirectException $ e ) {
355358 // should return `null` for disable output and setup redirect headers
356359 $ result = $ this ->redirect ($ e );
357- } catch (\ Exception $ e ) {
360+ } catch (Exception $ e ) {
358361 // dispatch default error controller
359362 $ result = $ this ->error ($ e );
360363 }
@@ -386,17 +389,15 @@ protected function postProcess(): void
386389 * Call dispatch from any \Bluz\Package
387390 * Application::getInstance()->dispatch($module, $controller, array $params);
388391 *
389- * @param string $module
390- * @param string $controller
391- * @param array $params
392+ * @param string $module
393+ * @param string $controller
394+ * @param array $params
392395 *
393396 * @return Controller
394- * @throws ComponentException
395397 * @throws CommonException
398+ * @throws ComponentException
396399 * @throws ControllerException
397- * @throws ForbiddenException
398- * @throws NotAcceptableException
399- * @throws NotAllowedException
400+ * @throws ReflectionException
400401 */
401402 public function dispatch ($ module , $ controller , array $ params = []): Controller
402403 {
@@ -436,11 +437,12 @@ protected function preDispatch($controller): void
436437 /**
437438 * Do dispatch
438439 *
439- * @param Controller $controller
440+ * @param Controller $controller
440441 *
441442 * @return void
442443 * @throws ComponentException
443444 * @throws ControllerException
445+ * @throws ReflectionException
444446 */
445447 protected function doDispatch ($ controller ): void
446448 {
@@ -461,7 +463,7 @@ protected function postDispatch($controller): void
461463 }
462464
463465 /**
464- * Render, is send Response
466+ * Render send Response
465467 *
466468 * @return void
467469 */
@@ -477,6 +479,6 @@ public function render(): void
477479 */
478480 public function end (): void
479481 {
480- // nothing
482+ // nothing by default
481483 }
482484}
0 commit comments