1 | <?php |
||
11 | abstract class AbstractController |
||
12 | { |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | private $container; |
||
17 | |||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $data; |
||
22 | |||
23 | public function __construct(array $container) |
||
27 | |||
28 | /** |
||
29 | * @param string $name Item name |
||
30 | * |
||
31 | * @return mixed Item from container |
||
32 | */ |
||
33 | public function get(string $name) |
||
41 | |||
42 | /** |
||
43 | * @param string $name Config name |
||
44 | * |
||
45 | * @return mixed Config value |
||
46 | */ |
||
47 | public function config(string $name) |
||
55 | |||
56 | /** |
||
57 | * Get request variable. |
||
58 | * |
||
59 | * @param string $type Request type |
||
60 | * @param string $name Index name. Null for all |
||
61 | * |
||
62 | * @return mixed |
||
63 | */ |
||
64 | public function getFromRequest(string $type = 'get', string $name = null) |
||
82 | |||
83 | public function dir(): string |
||
87 | |||
88 | public function isLogged(): bool |
||
92 | |||
93 | /** |
||
94 | * @param string $type Message type |
||
95 | * @param string $message Message content |
||
96 | * |
||
97 | * @return void |
||
98 | */ |
||
99 | public function setMessage($type = 'success', $message = 'Success') |
||
120 | |||
121 | /** |
||
122 | * Redirect. |
||
123 | * |
||
124 | * @param string $path Path to redirect |
||
125 | * |
||
126 | * @return void |
||
127 | */ |
||
128 | public function redirect($path) |
||
132 | |||
133 | public function terminate($code = 1) |
||
137 | |||
138 | private function selectMessagesTemplate() |
||
146 | |||
147 | public function render(string $template, array $data = []) |
||
183 | } |
||
184 |