@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @param Route $route |
38 | 38 | */ |
39 | - public function __construct(Route $route,ResponseInterface $response) |
|
39 | + public function __construct(Route $route, ResponseInterface $response) |
|
40 | 40 | { |
41 | 41 | $this->route = $route; |
42 | 42 | $this->response = $response; |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | $this->response->setContent(call_user_func_array($this->route->getTarget('callback')[$this->route->getTarget('extension')], [$this->route])); |
54 | 54 | else { |
55 | 55 | ob_start(); |
56 | - if(isset($this->route->getTarget()['data']))extract($this->route->getTarget('data')); |
|
57 | - if(isset($this->route->getParams()['data']))extract($this->route->getParams()['data']); |
|
56 | + if (isset($this->route->getTarget()['data']))extract($this->route->getTarget('data')); |
|
57 | + if (isset($this->route->getParams()['data']))extract($this->route->getParams()['data']); |
|
58 | 58 | require($this->route->getTarget('template')); |
59 | 59 | $this->response->setContent(ob_get_clean()); |
60 | 60 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * @param $extension |
65 | 65 | */ |
66 | - public function setContentType($extension){ |
|
66 | + public function setContentType($extension) { |
|
67 | 67 | $this->response->setStatusCode(200); |
68 | 68 | isset($this->types[$extension]) |
69 | 69 | ? $this->response->setHeaders(['Content-Type' => $this->types[$extension]]) |
@@ -47,14 +47,19 @@ |
||
47 | 47 | */ |
48 | 48 | public function call() |
49 | 49 | { |
50 | - if ($this->response->getStatusCode() == 202) |
|
51 | - $this->setContentType($this->route->getTarget('extension')); |
|
52 | - if (isset($this->route->getTarget('callback')[$this->route->getTarget('extension')])) |
|
53 | - $this->response->setContent(call_user_func_array($this->route->getTarget('callback')[$this->route->getTarget('extension')], [$this->route])); |
|
54 | - else { |
|
50 | + if ($this->response->getStatusCode() == 202) { |
|
51 | + $this->setContentType($this->route->getTarget('extension')); |
|
52 | + } |
|
53 | + if (isset($this->route->getTarget('callback')[$this->route->getTarget('extension')])) { |
|
54 | + $this->response->setContent(call_user_func_array($this->route->getTarget('callback')[$this->route->getTarget('extension')], [$this->route])); |
|
55 | + } else { |
|
55 | 56 | ob_start(); |
56 | - if(isset($this->route->getTarget()['data']))extract($this->route->getTarget('data')); |
|
57 | - if(isset($this->route->getParams()['data']))extract($this->route->getParams()['data']); |
|
57 | + if(isset($this->route->getTarget()['data'])) { |
|
58 | + extract($this->route->getTarget('data')); |
|
59 | + } |
|
60 | + if(isset($this->route->getParams()['data'])) { |
|
61 | + extract($this->route->getParams()['data']); |
|
62 | + } |
|
58 | 63 | require($this->route->getTarget('template')); |
59 | 64 | $this->response->setContent(ob_get_clean()); |
60 | 65 | } |