1 | <?php |
||
9 | class ClassHandler extends Handler implements RouteHandlerInterface |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $controller; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $method; |
||
21 | |||
22 | /** |
||
23 | * @param string $controller |
||
24 | * @param string $method |
||
25 | * @return ClassHandler |
||
26 | */ |
||
27 | public static function add($controller, $method){ |
||
30 | |||
31 | /** |
||
32 | * |
||
33 | * Class Handler Construct. |
||
34 | * Controller Name and Method name provided as FQN. |
||
35 | * |
||
36 | * @param string $controller |
||
37 | * @param string $method |
||
38 | * |
||
39 | * @throws \Exception |
||
40 | */ |
||
41 | public function __construct($controller = '', $method = '') |
||
47 | |||
48 | /** |
||
49 | * Resolve Controller and inject Arguments into construct. Normally this this the View. |
||
50 | * @param array ...$arguments |
||
51 | * @return $this |
||
52 | * @throws \Exception |
||
53 | */ |
||
54 | public function resolve(...$arguments){ |
||
71 | |||
72 | |||
73 | /** |
||
74 | * Returns Response Object from Handler. |
||
75 | * @param array $vars |
||
76 | * |
||
77 | * @return ResponseInterface |
||
78 | * @throws \Exception |
||
79 | */ |
||
80 | public function getResponse($vars = [] ){ |
||
91 | |||
92 | /** |
||
93 | * Check that controller exists. |
||
94 | * @param $controller |
||
95 | * |
||
96 | * @return bool |
||
97 | * @throws \Exception controller:{controller} not found |
||
98 | */ |
||
99 | private function resolveController($controller){ |
||
106 | |||
107 | /** |
||
108 | * Check that the method exists. |
||
109 | * @param $method |
||
110 | * |
||
111 | * @return bool |
||
112 | * @throws \Exception |
||
113 | */ |
||
114 | private function resolveMethod($method){ |
||
120 | } |
||
121 |