@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | |
45 | 45 | public function __construct($uri, $method, $response, array $middlewares = []) { |
46 | 46 | $this->uri = $uri; |
47 | - if(!in_array(mb_strtoupper($method), $this->availableRequestMethods)) { |
|
47 | + if (!in_array(mb_strtoupper($method), $this->availableRequestMethods)) { |
|
48 | 48 | throw new MethodException("The request method is invalid"); |
49 | 49 | } |
50 | 50 | $this->method = $method; |
51 | 51 | $this->response = $response; |
52 | - if($this->isValidMiddleware($middlewares)) { |
|
52 | + if ($this->isValidMiddleware($middlewares)) { |
|
53 | 53 | $this->middlewares = $middlewares; |
54 | 54 | } |
55 | 55 | } |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | |
127 | 127 | private function isValidMiddleware($middleware) { |
128 | 128 | // if there is not middlewares then it is valid |
129 | - if(count($middleware) === 0) { |
|
129 | + if (count($middleware) === 0) { |
|
130 | 130 | return true; |
131 | 131 | } |
132 | 132 | |
133 | - foreach($middleware as $key => $value) { |
|
134 | - if(!in_array($key, $this->middlewareTypes)) { |
|
133 | + foreach ($middleware as $key => $value) { |
|
134 | + if (!in_array($key, $this->middlewareTypes)) { |
|
135 | 135 | throw new InvalidMiddlewareException("Only before and after middleware types are valid"); |
136 | 136 | } |
137 | - if(!is_callable($value)) { |
|
137 | + if (!is_callable($value)) { |
|
138 | 138 | throw new InvalidMiddlewareException("The middleware must be callable"); |
139 | 139 | } |
140 | 140 | } |