| Total Complexity | 9 |
| Total Lines | 75 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | abstract class _Controller |
||
| 18 | { |
||
| 19 | protected $container; |
||
| 20 | |||
| 21 | function __construct(ContainerInterface $container) |
||
| 22 | { |
||
| 23 | $this->container = $container; |
||
| 24 | } |
||
| 25 | |||
| 26 | public function __get($property) |
||
| 27 | { |
||
| 28 | if ($this->container->{$property}) { |
||
| 29 | return $this->container->{$property}; |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | /** |
||
| 37 | * Get Slim Container |
||
| 38 | * |
||
| 39 | * @return ContainerInterface |
||
| 40 | */ |
||
| 41 | protected function getContainer() |
||
| 42 | { |
||
| 43 | return $this->container; |
||
| 44 | } |
||
| 45 | /** |
||
| 46 | * Get Service From Container |
||
| 47 | * |
||
| 48 | * @param string $service |
||
| 49 | * @return mixed |
||
| 50 | */ |
||
| 51 | protected function getService($service) |
||
| 52 | { |
||
| 53 | return $this->container->{$service}; |
||
| 54 | } |
||
| 55 | /** |
||
| 56 | * Get Request |
||
| 57 | * |
||
| 58 | * @return Request |
||
| 59 | */ |
||
| 60 | protected function getRequest() |
||
| 61 | { |
||
| 62 | return $this->container->request; |
||
|
|
|||
| 63 | } |
||
| 64 | /** |
||
| 65 | * Get Response |
||
| 66 | * |
||
| 67 | * @return Response |
||
| 68 | */ |
||
| 69 | protected function getResponse() |
||
| 72 | } |
||
| 73 | /** |
||
| 74 | * Get Twig Engine |
||
| 75 | * |
||
| 76 | * @return Blade |
||
| 77 | */ |
||
| 78 | protected function getView() |
||
| 79 | { |
||
| 80 | return $this->container->view; |
||
| 81 | } |
||
| 82 | /** |
||
| 83 | * Render view |
||
| 84 | * |
||
| 85 | * @param string $template |
||
| 86 | * @param array $data |
||
| 87 | * @return ResponseInterface |
||
| 88 | */ |
||
| 89 | protected function render($template, $data = []) |
||
| 92 | } |
||
| 93 | |||
| 94 | |||
| 95 | } |