@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @param string $method |
25 | 25 | * @return ClassHandler |
26 | 26 | */ |
27 | - public static function add($controller, $method){ |
|
27 | + public static function add($controller, $method) { |
|
28 | 28 | return new ClassHandler($controller, $method); |
29 | 29 | } |
30 | 30 | |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | * @return $this |
52 | 52 | * @throws \Exception |
53 | 53 | */ |
54 | - public function resolve(...$arguments){ |
|
54 | + public function resolve(...$arguments) { |
|
55 | 55 | |
56 | 56 | |
57 | - $controllerMethod = explode('::',$this->getPreResponse()); |
|
57 | + $controllerMethod = explode('::', $this->getPreResponse()); |
|
58 | 58 | |
59 | 59 | $this->controller = isset($controllerMethod[0]) ? $controllerMethod[0] : $this->controller; |
60 | 60 | $this->method = isset($controllerMethod[1]) ? $controllerMethod[1] : $this->method; |
61 | 61 | |
62 | - try{ |
|
63 | - $this->resolveController( $this->controller); |
|
64 | - $this->resolveMethod( $this->method ); |
|
62 | + try { |
|
63 | + $this->resolveController($this->controller); |
|
64 | + $this->resolveMethod($this->method); |
|
65 | 65 | $this->resolved = new $this->controller(...$arguments); |
66 | - }catch(\Exception $e){ |
|
66 | + }catch (\Exception $e) { |
|
67 | 67 | throw new \Exception($e->getMessage()); |
68 | 68 | } |
69 | 69 | return $this; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * @return ResponseInterface |
78 | 78 | * @throws \Exception |
79 | 79 | */ |
80 | - public function getResponse($vars = [] ){ |
|
80 | + public function getResponse($vars = []) { |
|
81 | 81 | |
82 | - if ($this->resolved === null){ |
|
82 | + if ($this->resolved === null) { |
|
83 | 83 | throw new \Exception("Handler must be resolved before calling getContents()."); |
84 | 84 | } |
85 | 85 | |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | * @return bool |
97 | 97 | * @throws \Exception controller:{controller} not found |
98 | 98 | */ |
99 | - private function resolveController($controller){ |
|
99 | + private function resolveController($controller) { |
|
100 | 100 | |
101 | - if ( !class_exists($controller)){ |
|
101 | + if (!class_exists($controller)) { |
|
102 | 102 | throw new \Exception("Controller {$controller} not found"); |
103 | 103 | } |
104 | 104 | return true; |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * @return bool |
112 | 112 | * @throws \Exception |
113 | 113 | */ |
114 | - private function resolveMethod($method){ |
|
115 | - if (method_exists($this->controller,$method)){ |
|
114 | + private function resolveMethod($method) { |
|
115 | + if (method_exists($this->controller, $method)) { |
|
116 | 116 | return true; |
117 | 117 | } |
118 | 118 | throw new \Exception("method: {$this->controller}::{$method} not found"); |