@@ -17,7 +17,7 @@ |
||
17 | 17 | public function __construct($body) { |
18 | 18 | $this->jsonString = $body; |
19 | 19 | $this->parsedData = json_decode($body, true); |
20 | - if($this->parsedData === null) { |
|
20 | + if ($this->parsedData === null) { |
|
21 | 21 | throw new InvalidRequestDataException('Content not valid JSON'); |
22 | 22 | } |
23 | 23 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @internal param string $extension |
65 | 65 | */ |
66 | 66 | |
67 | - public function __construct($method, array $headers, RequestData $body, RequestData $urlData, $ip, $version, $apiKey, $endpoint, array $acceptableMIMETypes = [], $instance = null){ |
|
67 | + public function __construct($method, array $headers, RequestData $body, RequestData $urlData, $ip, $version, $apiKey, $endpoint, array $acceptableMIMETypes = [], $instance = null) { |
|
68 | 68 | $this->method = strtolower($method); |
69 | 69 | $this->headers = $headers; |
70 | 70 | $this->body = $body; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @return string |
89 | 89 | */ |
90 | 90 | public function getMethod() { |
91 | - return $this->method . ($this->instance ? '' : 'All'); |
|
91 | + return $this->method.($this->instance ? '' : 'All'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -64,7 +64,7 @@ |
||
64 | 64 | * @internal param string $extension |
65 | 65 | */ |
66 | 66 | |
67 | - public function __construct($method, array $headers, RequestData $body, RequestData $urlData, $ip, $version, $apiKey, $endpoint, array $acceptableMIMETypes = [], $instance = null){ |
|
67 | + public function __construct($method, array $headers, RequestData $body, RequestData $urlData, $ip, $version, $apiKey, $endpoint, array $acceptableMIMETypes = [], $instance = null) { |
|
68 | 68 | $this->method = strtolower($method); |
69 | 69 | $this->headers = $headers; |
70 | 70 | $this->body = $body; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @return BodyParser |
9 | 9 | */ |
10 | 10 | public function create(string $contentType): BodyParser { |
11 | - switch($contentType) { |
|
11 | + switch ($contentType) { |
|
12 | 12 | case 'application/x-www-form-urlencoded': |
13 | 13 | default: |
14 | 14 | return new URLEncodedBodyParser(); |
@@ -57,7 +57,7 @@ |
||
57 | 57 | $parsedData = $bodyParser->parse($data); |
58 | 58 | |
59 | 59 | $apiKey = $parsedURL->getAPIKey(); |
60 | - if($apiKey === null) { |
|
60 | + if ($apiKey === null) { |
|
61 | 61 | $apiKey = $parsedHeaders->getAPIKey(); |
62 | 62 | } |
63 | 63 |
@@ -40,28 +40,28 @@ |
||
40 | 40 | |
41 | 41 | try { |
42 | 42 | $response = $this->server->handleRequest($request); |
43 | - header("Content-Type: " . $response->getMIMEType()); |
|
43 | + header("Content-Type: ".$response->getMIMEType()); |
|
44 | 44 | echo $response->getAsString(); |
45 | - } catch(InvalidAPIKeyException $e){ |
|
45 | + } catch (InvalidAPIKeyException $e) { |
|
46 | 46 | header('400 Bad Request', true, 400); |
47 | - } catch(UnknownEndpointException $e){ |
|
47 | + } catch (UnknownEndpointException $e) { |
|
48 | 48 | header('404 Not Found', true, 404); |
49 | - } catch(NotAcceptableResponseTypeException $e){ |
|
49 | + } catch (NotAcceptableResponseTypeException $e) { |
|
50 | 50 | header('406 Not Acceptable', true, 406); |
51 | - } catch(AccessDeniedException $e){ |
|
51 | + } catch (AccessDeniedException $e) { |
|
52 | 52 | header('403 Access Denied', true, 403); |
53 | - } catch(ThrottleLimitExceededException $e){ |
|
53 | + } catch (ThrottleLimitExceededException $e) { |
|
54 | 54 | header('429 Too Many Requests', true, 429); |
55 | 55 | } catch (\Exception $e) { |
56 | 56 | header('500 Internal Server Error', true, 500); |
57 | 57 | } |
58 | - } catch(InvalidRequestURLException $e){ |
|
58 | + } catch (InvalidRequestURLException $e) { |
|
59 | 59 | header('400 Bad Request', true, 400); |
60 | - } catch(UnknownContentTypeException $e){ |
|
60 | + } catch (UnknownContentTypeException $e) { |
|
61 | 61 | header('400 Bad Request', true, 400); |
62 | - } catch(InvalidRequestDataException $e){ |
|
62 | + } catch (InvalidRequestDataException $e) { |
|
63 | 63 | header('400 Bad Request', true, 400); |
64 | - } catch(\Exception $e){ |
|
64 | + } catch (\Exception $e) { |
|
65 | 65 | header('500 Internal Server Error', true, 500); |
66 | 66 | } |
67 | 67 | } |
@@ -42,26 +42,26 @@ |
||
42 | 42 | $response = $this->server->handleRequest($request); |
43 | 43 | header("Content-Type: " . $response->getMIMEType()); |
44 | 44 | echo $response->getAsString(); |
45 | - } catch(InvalidAPIKeyException $e){ |
|
45 | + } catch(InvalidAPIKeyException $e) { |
|
46 | 46 | header('400 Bad Request', true, 400); |
47 | - } catch(UnknownEndpointException $e){ |
|
47 | + } catch(UnknownEndpointException $e) { |
|
48 | 48 | header('404 Not Found', true, 404); |
49 | - } catch(NotAcceptableResponseTypeException $e){ |
|
49 | + } catch(NotAcceptableResponseTypeException $e) { |
|
50 | 50 | header('406 Not Acceptable', true, 406); |
51 | - } catch(AccessDeniedException $e){ |
|
51 | + } catch(AccessDeniedException $e) { |
|
52 | 52 | header('403 Access Denied', true, 403); |
53 | - } catch(ThrottleLimitExceededException $e){ |
|
53 | + } catch(ThrottleLimitExceededException $e) { |
|
54 | 54 | header('429 Too Many Requests', true, 429); |
55 | 55 | } catch (\Exception $e) { |
56 | 56 | header('500 Internal Server Error', true, 500); |
57 | 57 | } |
58 | - } catch(InvalidRequestURLException $e){ |
|
58 | + } catch(InvalidRequestURLException $e) { |
|
59 | 59 | header('400 Bad Request', true, 400); |
60 | - } catch(UnknownContentTypeException $e){ |
|
60 | + } catch(UnknownContentTypeException $e) { |
|
61 | 61 | header('400 Bad Request', true, 400); |
62 | - } catch(InvalidRequestDataException $e){ |
|
62 | + } catch(InvalidRequestDataException $e) { |
|
63 | 63 | header('400 Bad Request', true, 400); |
64 | - } catch(\Exception $e){ |
|
64 | + } catch(\Exception $e) { |
|
65 | 65 | header('500 Internal Server Error', true, 500); |
66 | 66 | } |
67 | 67 | } |