11<?php
2- /**
3- * @see https://github.com/dotkernel/dot-controller/ for the canonical source repository
4- * @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com)
5- * @license https://github.com/dotkernel/dot-controller/blob/master/LICENSE.md MIT License
6- */
72
8- declare (strict_types = 1 );
3+ declare (strict_types= 1 );
94
105namespace Dot \Controller ;
116
127use Dot \Controller \Event \ControllerEvent ;
138use Psr \Http \Message \ResponseInterface ;
149
15- /**
16- * Class AbstractActionController
17- * @package Dot\Controller
18- */
10+ use function array_merge ;
11+ use function method_exists ;
12+ use function strtolower ;
13+ use function trim ;
14+
1915abstract class AbstractActionController extends AbstractController
2016{
21- /**
22- * @return ResponseInterface
23- */
2417 public function dispatch (): ResponseInterface
2518 {
2619 $ action = strtolower (trim ($ this ->request ->getAttribute ('action ' , 'index ' )));
@@ -32,18 +25,18 @@ public function dispatch(): ResponseInterface
3225
3326 if (method_exists ($ this , $ action )) {
3427 $ r = $ this ->dispatchEvent (ControllerEvent::EVENT_CONTROLLER_BEFORE_DISPATCH , [
35- 'request ' => $ this ->request ,
36- 'handler ' => $ this ->getHandler (),
28+ 'request ' => $ this ->request ,
29+ 'handler ' => $ this ->getHandler (),
3730 'controller ' => $ this ,
38- 'method ' => $ action
31+ 'method ' => $ action,
3932 ]);
4033 if ($ r instanceof ResponseInterface) {
4134 return $ r ;
4235 }
4336
4437 $ this ->request = $ r ->getParam ('request ' );
45- $ response = $ this ->$ action ();
46- $ params = array_merge ($ r ->getParams (), ['response ' => $ response ]);
38+ $ response = $ this ->$ action ();
39+ $ params = array_merge ($ r ->getParams (), ['response ' => $ response ]);
4740
4841 $ r = $ this ->dispatchEvent (ControllerEvent::EVENT_CONTROLLER_AFTER_DISPATCH , $ params );
4942 if ($ r instanceof ResponseInterface) {
0 commit comments