@@ -1,8 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace LunixREST\APIRequest\HeaderParser; |
3 | 3 | |
4 | -class DefaultHeaderParser implements HeaderParser |
|
5 | -{ |
|
4 | +class DefaultHeaderParser implements HeaderParser { |
|
6 | 5 | |
7 | 6 | private $apiKeyHeaderKey; |
8 | 7 | |
@@ -10,8 +9,7 @@ discard block |
||
10 | 9 | * DefaultHeaderParser constructor. |
11 | 10 | * @param string $apiKeyHeaderKey |
12 | 11 | */ |
13 | - public function __construct($apiKeyHeaderKey = 'x-api-key') |
|
14 | - { |
|
12 | + public function __construct($apiKeyHeaderKey = 'x-api-key') { |
|
15 | 13 | $this->apiKeyHeaderKey = $apiKeyHeaderKey; |
16 | 14 | } |
17 | 15 | |
@@ -43,8 +41,7 @@ discard block |
||
43 | 41 | return $acceptedMIMETypes; |
44 | 42 | } |
45 | 43 | |
46 | - protected function findAPIKey(array $headers) |
|
47 | - { |
|
44 | + protected function findAPIKey(array $headers) { |
|
48 | 45 | foreach ($headers as $key => $values) { |
49 | 46 | if (strtolower($key) == strtolower($this->apiKeyHeaderKey)) { |
50 | 47 | foreach($values as $value) { |
@@ -55,8 +52,7 @@ discard block |
||
55 | 52 | return null; |
56 | 53 | } |
57 | 54 | |
58 | - protected function getContentType(array $headers) |
|
59 | - { |
|
55 | + protected function getContentType(array $headers) { |
|
60 | 56 | foreach ($headers as $key => $values) { |
61 | 57 | if (strtolower($key) == 'content-type') { |
62 | 58 | foreach ($values as $value) { |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace LunixREST\APIRequest\HeaderParser; |
3 | 3 | |
4 | -interface HeaderParser |
|
5 | -{ |
|
4 | +interface HeaderParser { |
|
6 | 5 | public function parse(array $headers): ParsedHeaders; |
7 | 6 | } |
@@ -1,8 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace LunixREST\APIRequest\HeaderParser; |
3 | 3 | |
4 | -class ParsedHeaders |
|
5 | -{ |
|
4 | +class ParsedHeaders { |
|
6 | 5 | /** |
7 | 6 | * @var array |
8 | 7 | */ |
@@ -16,15 +15,13 @@ discard block |
||
16 | 15 | * @param array $acceptableMIMETypes |
17 | 16 | * @param $APIKey |
18 | 17 | */ |
19 | - public function __construct($contentType, array $acceptableMIMETypes, $APIKey) |
|
20 | - { |
|
18 | + public function __construct($contentType, array $acceptableMIMETypes, $APIKey) { |
|
21 | 19 | $this->contentType = $contentType; |
22 | 20 | $this->acceptableMIMETypes = $acceptableMIMETypes; |
23 | 21 | $this->APIKey = $APIKey; |
24 | 22 | } |
25 | 23 | |
26 | - public function getContentType() |
|
27 | - { |
|
24 | + public function getContentType() { |
|
28 | 25 | return $this->contentType; |
29 | 26 | } |
30 | 27 | |
@@ -33,8 +30,7 @@ discard block |
||
33 | 30 | return $this->acceptableMIMETypes; |
34 | 31 | } |
35 | 32 | |
36 | - public function getAPIKey() |
|
37 | - { |
|
33 | + public function getAPIKey() { |
|
38 | 34 | return $this->APIKey; |
39 | 35 | } |
40 | 36 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace LunixREST\APIRequest\URLParser\Exceptions; |
3 | 3 | |
4 | -class InvalidRequestURLException extends \Exception |
|
5 | -{ |
|
4 | +class InvalidRequestURLException extends \Exception { |
|
6 | 5 | |
7 | 6 | } |
@@ -4,8 +4,7 @@ |
||
4 | 4 | use LunixREST\APIRequest\URLParser\Exceptions\InvalidRequestURLException; |
5 | 5 | use Psr\Http\Message\UriInterface; |
6 | 6 | |
7 | -interface URLParser |
|
8 | -{ |
|
7 | +interface URLParser { |
|
9 | 8 | /** |
10 | 9 | * Parses API request data out of a url |
11 | 10 | * @param UriInterface $uri |
@@ -9,10 +9,8 @@ |
||
9 | 9 | * Class BasicRequestFactory |
10 | 10 | * @package LunixREST\Request\RequestFactory |
11 | 11 | */ |
12 | -class DefaultRequestFactory extends GenericRequestFactory |
|
13 | -{ |
|
14 | - public function __construct(URLParser $URLParser) |
|
15 | - { |
|
12 | +class DefaultRequestFactory extends GenericRequestFactory { |
|
13 | + public function __construct(URLParser $URLParser) { |
|
16 | 14 | parent::__construct($URLParser, new DefaultHeaderParser()); |
17 | 15 | } |
18 | 16 | } |
@@ -8,8 +8,7 @@ |
||
8 | 8 | * Interface Endpoint |
9 | 9 | * @package LunixREST\Endpoints |
10 | 10 | */ |
11 | -interface Endpoint |
|
12 | -{ |
|
11 | +interface Endpoint { |
|
13 | 12 | /** |
14 | 13 | * @param APIRequest $request |
15 | 14 | * @return null|array|object |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace LunixREST\Configuration\Exceptions; |
3 | 3 | |
4 | -class INIParseException extends \Exception |
|
5 | -{ |
|
4 | +class INIParseException extends \Exception { |
|
6 | 5 | |
7 | 6 | } |
@@ -5,8 +5,7 @@ |
||
5 | 5 | * Interface Configuration |
6 | 6 | * @package LunixREST\Configuration |
7 | 7 | */ |
8 | -interface Configuration |
|
9 | -{ |
|
8 | +interface Configuration { |
|
10 | 9 | /** |
11 | 10 | * @param $key |
12 | 11 | * @param null|string $namespace |