@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | public function findAcceptableMIMETypes(array $headers): array{ |
17 | 17 | //TODO: follow RFC2616 order |
18 | 18 | $acceptedMIMETypes = []; |
19 | - foreach($headers as $key => $value) { |
|
20 | - if(strtolower($key) == 'http-accept'){ |
|
19 | + foreach ($headers as $key => $value) { |
|
20 | + if (strtolower($key) == 'http-accept') { |
|
21 | 21 | $values = explode(',', $value); |
22 | - foreach($values as $acceptedType) { |
|
22 | + foreach ($values as $acceptedType) { |
|
23 | 23 | $typeParts = explode(';', $acceptedType); |
24 | - if(count($typeParts) > 0 ){ |
|
24 | + if (count($typeParts) > 0) { |
|
25 | 25 | $acceptedMIMETypes[] = trim($typeParts); |
26 | 26 | } |
27 | 27 | } |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | return $acceptedMIMETypes; |
32 | 32 | } |
33 | 33 | |
34 | - public function findAPIKey(array $headers){ |
|
35 | - foreach($headers as $key => $value) { |
|
36 | - if(strtolower($key) == $this->apiKeyHeaderKey){ |
|
34 | + public function findAPIKey(array $headers) { |
|
35 | + foreach ($headers as $key => $value) { |
|
36 | + if (strtolower($key) == $this->apiKeyHeaderKey) { |
|
37 | 37 | return $value; |
38 | 38 | } |
39 | 39 | } |
40 | 40 | return null; |
41 | 41 | } |
42 | 42 | |
43 | - public function getContentType(array $headers){ |
|
44 | - foreach($headers as $key => $value) { |
|
45 | - if(strtolower($key) == 'content-type'){ |
|
43 | + public function getContentType(array $headers) { |
|
44 | + foreach ($headers as $key => $value) { |
|
45 | + if (strtolower($key) == 'content-type') { |
|
46 | 46 | return $value; |
47 | 47 | } |
48 | 48 | } |
@@ -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 | /** |
@@ -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 |