1 | <?php |
||
16 | class BaseController |
||
17 | { |
||
18 | /** |
||
19 | * @param string $packageRoot |
||
20 | * @param Request $request |
||
21 | */ |
||
22 | public function __construct(string &$packageRoot, Request &$request) |
||
30 | |||
31 | /** |
||
32 | * @param string $handler |
||
33 | */ |
||
34 | public function invoke(string $handler) |
||
38 | |||
39 | /** |
||
40 | * @return Response |
||
41 | */ |
||
42 | public function getResponse(): Response |
||
46 | |||
47 | /** |
||
48 | * @param bool $delete |
||
49 | */ |
||
50 | protected function deleteJsonKeys(bool $delete) |
||
54 | |||
55 | /** |
||
56 | * @param Response $response |
||
57 | */ |
||
58 | protected function setResponse(Response &$response) |
||
62 | |||
63 | /** |
||
64 | * Add items to the template data array. |
||
65 | * |
||
66 | * @param array $data |
||
67 | */ |
||
68 | protected function addData(array $data) |
||
72 | |||
73 | /** |
||
74 | * Create Response from template. |
||
75 | * |
||
76 | * @param string $name |
||
77 | * @param array $data |
||
78 | */ |
||
79 | protected function setView(string $name = '', array $data = []) |
||
87 | |||
88 | /** |
||
89 | * Create Response from content. |
||
90 | * |
||
91 | * @param string $content |
||
92 | */ |
||
93 | protected function setContent(string $content) |
||
97 | |||
98 | /** |
||
99 | * Create Response from content. |
||
100 | * |
||
101 | * @param array $content |
||
102 | */ |
||
103 | protected function setJSONContent(array $content) |
||
112 | |||
113 | /** |
||
114 | * Redirect to the URL with statusCode. |
||
115 | * |
||
116 | * @param string $url |
||
117 | * @param int $statusCode |
||
118 | */ |
||
119 | protected function setRedirect(string $url = '', int $statusCode = 303) |
||
123 | |||
124 | /** |
||
125 | * Get route digit's. |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | protected function getNumList(): array |
||
138 | |||
139 | /** |
||
140 | * @param $arr |
||
141 | * @return array |
||
142 | */ |
||
143 | private function deleteArrayKeys(&$arr): array |
||
155 | |||
156 | protected $request; |
||
157 | protected $response; |
||
158 | protected $data; |
||
159 | protected $deleteJsonKeys; |
||
160 | |||
161 | private $packageRoot; |
||
162 | } |