@@ -156,8 +156,8 @@ |
||
156 | 156 | public static function getRequestVerb():string |
157 | 157 | { |
158 | 158 | $helper = new helper; |
159 | - $method = $helper->checkVal(@$_SERVER, 'REQUEST_METHOD', '' ); |
|
160 | - $method = $helper->checkVal(@$_SERVER, 'HTTP_X_HTTP_METHOD', $method ); |
|
159 | + $method = $helper->checkVal(@$_SERVER, 'REQUEST_METHOD', ''); |
|
160 | + $method = $helper->checkVal(@$_SERVER, 'HTTP_X_HTTP_METHOD', $method); |
|
161 | 161 | |
162 | 162 | return strtolower($method); |
163 | 163 | } |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function setPostBody($payload) |
104 | 104 | { |
105 | - if( !empty($this->payloadBody) ) { |
|
105 | + if (!empty($this->payloadBody)) { |
|
106 | 106 | $payload = array_merge($this->payloadBody, ['post' => $payload]); |
107 | 107 | } |
108 | 108 | |
109 | - if( !empty($this->requestBody) ) { |
|
109 | + if (!empty($this->requestBody)) { |
|
110 | 110 | $payload = array_merge($this->requestBody, ['post' => $payload]); |
111 | 111 | } |
112 | 112 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function getRequestBody() |
146 | 146 | { |
147 | - if( isset($this->requestBody['payload']) ) { |
|
147 | + if (isset($this->requestBody['payload'])) { |
|
148 | 148 | return $this->requestBody['payload']; |
149 | 149 | } |
150 | 150 | return $this->requestBody; |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | ), |
197 | 197 | ); |
198 | 198 | |
199 | - $this->setRoutes((object)$routesArray); |
|
199 | + $this->setRoutes((object) $routesArray); |
|
200 | 200 | |
201 | 201 | return $this->getRoutes(); |
202 | 202 | } |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | /** |
77 | 77 | * Check if a custom directory was set in the Responsible API options |
78 | 78 | */ |
79 | - if( (isset($options['classRoute']) && !empty($options['classRoute'])) && |
|
79 | + if ((isset($options['classRoute']) && !empty($options['classRoute'])) && |
|
80 | 80 | (isset($options['classRoute']['directory']) && isset($options['classRoute']['namespace'])) |
81 | 81 | ) { |
82 | 82 | $customService = $this->options['classRoute']; |
83 | 83 | $directory = $customService['directory']; |
84 | 84 | $middleware = $customService['namespace']; |
85 | 85 | |
86 | - }else { |
|
86 | + } else { |
|
87 | 87 | $middleware = 'responsible'; |
88 | 88 | |
89 | 89 | $endpoint = str_replace( |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if (class_exists($child) && method_exists($child, 'register')) { |
142 | 142 | self::$middleWareClass = new $child; |
143 | 143 | $this->registry[$point] = self::$middleWareClass->register(); |
144 | - }else{ |
|
144 | + } else { |
|
145 | 145 | (new exception\errorException) |
146 | 146 | ->setOptions($this->getOptions()) |
147 | 147 | ->message("Class Error:: class {$child} needs to exist. See documentation on setting up a service.") |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | * @var array |
233 | 233 | */ |
234 | 234 | if (array_search($endpoint, $this->registry[$api]) !== false) { |
235 | - if( method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope') ) { |
|
235 | + if (method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope')) { |
|
236 | 236 | $classScope = (new $this->NAMESPACE_ENDPOINTS[$api])->scope(); |
237 | 237 | $position = array_search($endpoint, $this->registry[$api]); |
238 | 238 | |
239 | - if( is_array($classScope) && isset($classScope[$position]) ) { |
|
239 | + if (is_array($classScope) && isset($classScope[$position])) { |
|
240 | 240 | $endpointSettings['model']['scope'] = $classScope[$position]; |
241 | 241 | |
242 | - }else{ |
|
242 | + } else { |
|
243 | 243 | |
244 | - if( !is_array($classScope) ) { |
|
244 | + if (!is_array($classScope)) { |
|
245 | 245 | $endpointSettings['model']['scope'] = $classScope; |
246 | 246 | } |
247 | 247 | } |
@@ -292,16 +292,16 @@ discard block |
||
292 | 292 | |
293 | 293 | $scope = 'private'; |
294 | 294 | |
295 | - if( method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope') ) { |
|
295 | + if (method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope')) { |
|
296 | 296 | $classScope = (new $this->NAMESPACE_ENDPOINTS[$api])->scope(); |
297 | 297 | $position = array_search($path, $this->registry[$api]); |
298 | 298 | |
299 | - if( is_array($classScope) && isset($classScope[$position]) ) { |
|
299 | + if (is_array($classScope) && isset($classScope[$position])) { |
|
300 | 300 | $scope = $classScope[$position]; |
301 | 301 | |
302 | - }else{ |
|
302 | + } else { |
|
303 | 303 | |
304 | - if( !is_array($classScope) ) { |
|
304 | + if (!is_array($classScope)) { |
|
305 | 305 | $scope = $classScope; |
306 | 306 | } |
307 | 307 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $directory = $customService['directory']; |
84 | 84 | $middleware = $customService['namespace']; |
85 | 85 | |
86 | - }else { |
|
86 | + } else { |
|
87 | 87 | $middleware = 'responsible'; |
88 | 88 | |
89 | 89 | $endpoint = str_replace( |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if (class_exists($child) && method_exists($child, 'register')) { |
142 | 142 | self::$middleWareClass = new $child; |
143 | 143 | $this->registry[$point] = self::$middleWareClass->register(); |
144 | - }else{ |
|
144 | + } else{ |
|
145 | 145 | (new exception\errorException) |
146 | 146 | ->setOptions($this->getOptions()) |
147 | 147 | ->message("Class Error:: class {$child} needs to exist. See documentation on setting up a service.") |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | if( is_array($classScope) && isset($classScope[$position]) ) { |
240 | 240 | $endpointSettings['model']['scope'] = $classScope[$position]; |
241 | 241 | |
242 | - }else{ |
|
242 | + } else{ |
|
243 | 243 | |
244 | 244 | if( !is_array($classScope) ) { |
245 | 245 | $endpointSettings['model']['scope'] = $classScope; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | if( is_array($classScope) && isset($classScope[$position]) ) { |
300 | 300 | $scope = $classScope[$position]; |
301 | 301 | |
302 | - }else{ |
|
302 | + } else{ |
|
303 | 303 | |
304 | 304 | if( !is_array($classScope) ) { |
305 | 305 | $scope = $classScope; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // Authenticate the API connections |
145 | 145 | try { |
146 | 146 | $this->server->authenticate(); |
147 | - }catch (responsibleException | \Exception $e) { |
|
147 | + } catch (responsibleException | \Exception $e) { |
|
148 | 148 | self::$response = $e->getMessage(); |
149 | 149 | return; |
150 | 150 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $this->getRateLimit(), |
156 | 156 | $this->getRateWindow() |
157 | 157 | ); |
158 | - }catch (responsibleException | \Exception $e) { |
|
158 | + } catch (responsibleException | \Exception $e) { |
|
159 | 159 | self::$response = $e->getMessage(); |
160 | 160 | return; |
161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // Build the APIs internal router |
164 | 164 | try { |
165 | 165 | $this->server->route($route); |
166 | - }catch (responsibleException | \Exception $e) { |
|
166 | + } catch (responsibleException | \Exception $e) { |
|
167 | 167 | self::$response = $e->getMessage(); |
168 | 168 | return; |
169 | 169 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $getJWT = (isset($options['getJWT']) && is_bool($options['getJWT'])) |
373 | 373 | ? $options['getJWT'] : true; |
374 | 374 | |
375 | - $getSecretAppend = (isset($options['secret']) && ($options['secret'] == 'append') ) |
|
375 | + $getSecretAppend = (isset($options['secret']) && ($options['secret'] == 'append')) |
|
376 | 376 | ? $options['secret'] : false; |
377 | 377 | |
378 | 378 | return (new user\user) |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // Authenticate the API connections |
145 | 145 | try { |
146 | 146 | $this->server->authenticate(); |
147 | - }catch (responsibleException | \Exception $e) { |
|
147 | + } catch (responsibleException | \Exception $e) { |
|
148 | 148 | self::$response = $e->getMessage(); |
149 | 149 | return; |
150 | 150 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $this->getRateLimit(), |
156 | 156 | $this->getRateWindow() |
157 | 157 | ); |
158 | - }catch (responsibleException | \Exception $e) { |
|
158 | + } catch (responsibleException | \Exception $e) { |
|
159 | 159 | self::$response = $e->getMessage(); |
160 | 160 | return; |
161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // Build the APIs internal router |
164 | 164 | try { |
165 | 165 | $this->server->route($route); |
166 | - }catch (responsibleException | \Exception $e) { |
|
166 | + } catch (responsibleException | \Exception $e) { |
|
167 | 167 | self::$response = $e->getMessage(); |
168 | 168 | return; |
169 | 169 | } |