1 | <?php |
||
10 | final class Framework |
||
11 | { |
||
12 | private $projectNamespace = '\Project'; |
||
13 | private $controllerPackage = '\Controller'; |
||
14 | private $controllerActionSuffix = 'Action'; |
||
15 | private $withParameterMatching = false; |
||
16 | |||
17 | /** |
||
18 | * Dispatch the request |
||
19 | * @throws \Exception |
||
20 | * @return mixed |
||
21 | */ |
||
22 | public function dispatch() |
||
36 | |||
37 | /** |
||
38 | * @param object $controller |
||
39 | * @param string $action |
||
40 | * @return array |
||
41 | */ |
||
42 | private function getParameterMatching(object $controller, string $action) |
||
53 | |||
54 | /** |
||
55 | * Return Controller instance from a controller name |
||
56 | * @param string $controllerName |
||
57 | * @return object |
||
58 | * @throws \Exception |
||
59 | */ |
||
60 | private function getControllerFromName($controllerName) |
||
68 | |||
69 | /** |
||
70 | * Return HTTP Method for request |
||
71 | * @return string |
||
72 | */ |
||
73 | private function getVerbFromRequest() |
||
77 | |||
78 | /** |
||
79 | * Returns Request uri without query string |
||
80 | * @return string |
||
81 | */ |
||
82 | private function getQuery() : string |
||
88 | |||
89 | /** |
||
90 | * Determine controller and action from Request Uri |
||
91 | * @return array |
||
92 | */ |
||
93 | private function getControllerAndAction() : array |
||
100 | |||
101 | /** |
||
102 | * Redefine personal namespace |
||
103 | * @param string $namespace |
||
104 | * @return Framework |
||
105 | */ |
||
106 | public function setNamespace(string $namespace = '\Project') : Framework |
||
111 | |||
112 | /** |
||
113 | * Redefine controller subpackage |
||
114 | * @param string $controllerPackage |
||
115 | * @return Framework |
||
116 | */ |
||
117 | public function setControllerPackage(string $controllerPackage = '\Controller') : Framework |
||
124 | |||
125 | /** |
||
126 | * Redefine controller action suffix |
||
127 | * @param string $suffix |
||
128 | * @return Framework |
||
129 | */ |
||
130 | public function setControllerActionSuffix(string $suffix = 'Action') : Framework |
||
135 | |||
136 | public function setParameterMatching($active = true) |
||
141 | } |
||
142 |