1 | <?php |
||
10 | final class Framework |
||
11 | { |
||
12 | private $projectNamespace = '\Project'; |
||
13 | private $controllerPackage = '\Controller'; |
||
14 | private $controllerActionSuffix = 'Action'; |
||
15 | |||
16 | /** |
||
17 | * Dispatch the request |
||
18 | * @throws \Exception |
||
19 | * @return mixed |
||
20 | */ |
||
21 | 9 | public function dispatch() |
|
39 | |||
40 | /** |
||
41 | * Return HTTP Method for request |
||
42 | * @return string |
||
43 | */ |
||
44 | 6 | private function getVerbFromRequest() |
|
48 | |||
49 | /** |
||
50 | * Returns Request uri without query string |
||
51 | * @return string |
||
52 | */ |
||
53 | 9 | private function getQuery() : string |
|
59 | |||
60 | /** |
||
61 | * Determine controller and action from Request Uri |
||
62 | * @return array |
||
63 | */ |
||
64 | 9 | private function getControllerAndAction() : array |
|
71 | |||
72 | /** |
||
73 | * Redefine personal namespace |
||
74 | * @param string $namespace |
||
75 | * @return Framework |
||
76 | */ |
||
77 | 3 | public function setNamespace(string $namespace = '\Project') : Framework |
|
82 | |||
83 | /** |
||
84 | * Redefine controller subpackage |
||
85 | * @param string $controllerPackage |
||
86 | * @return Framework |
||
87 | */ |
||
88 | 4 | public function setControllerPackage(string $controllerPackage = '\Controller') : Framework |
|
95 | |||
96 | /** |
||
97 | * Redefine controller action suffix |
||
98 | * @param string $suffix |
||
99 | * @return Framework |
||
100 | */ |
||
101 | 2 | public function setControllerActionSuffix(string $suffix = 'Action') : Framework |
|
106 | } |
||
107 |