@@ -20,7 +20,7 @@ |
||
20 | 20 | * @throws UnknownEndpointException |
21 | 21 | */ |
22 | 22 | public function getEndpoint(string $name, string $version): Endpoint { |
23 | - $className = $this->buildVersionedEndpointNamespace($version) . $name; |
|
23 | + $className = $this->buildVersionedEndpointNamespace($version).$name; |
|
24 | 24 | return new $className($this->entityManager); |
25 | 25 | } |
26 | 26 | } |
@@ -10,12 +10,10 @@ |
||
10 | 10 | * Class DoctrineNamespaceEndpointFactory |
11 | 11 | * @package LunixREST\Endpoint |
12 | 12 | */ |
13 | -class DoctrineNamespaceEndpointFactory extends NamespaceEndpointFactory |
|
14 | -{ |
|
13 | +class DoctrineNamespaceEndpointFactory extends NamespaceEndpointFactory { |
|
15 | 14 | protected $entityManager; |
16 | 15 | |
17 | - public function __construct(string $endpointNamespace, EntityManager $em) |
|
18 | - { |
|
16 | + public function __construct(string $endpointNamespace, EntityManager $em) { |
|
19 | 17 | parent::__construct($endpointNamespace); |
20 | 18 | $this->entityManager = $em; |
21 | 19 | } |
@@ -8,14 +8,12 @@ |
||
8 | 8 | * Class MIMEFileProvider |
9 | 9 | * @package LunixREST\Request |
10 | 10 | */ |
11 | -class MIMEFileProvider implements MIMEProvider |
|
12 | -{ |
|
11 | +class MIMEFileProvider implements MIMEProvider { |
|
13 | 12 | protected $file; |
14 | 13 | |
15 | 14 | protected $cache; |
16 | 15 | |
17 | - public function __construct($filePath = '/etc/mime.types') |
|
18 | - { |
|
16 | + public function __construct($filePath = '/etc/mime.types') { |
|
19 | 17 | $this->file = fopen($filePath, 'r'); |
20 | 18 | } |
21 | 19 |
@@ -10,10 +10,8 @@ |
||
10 | 10 | * Class BasicRequestFactory |
11 | 11 | * @package LunixREST\Request\RequestFactory |
12 | 12 | */ |
13 | -class DefaultRequestFactory extends GenericRequestFactory |
|
14 | -{ |
|
15 | - public function __construct(URLParser $URLParser) |
|
16 | - { |
|
13 | +class DefaultRequestFactory extends GenericRequestFactory { |
|
14 | + public function __construct(URLParser $URLParser) { |
|
17 | 15 | parent::__construct($URLParser, new DefaultBodyParserFactory(), new DefaultHeaderParser()); |
18 | 16 | } |
19 | 17 | } |
@@ -6,8 +6,7 @@ |
||
6 | 6 | use LunixREST\Request\Request; |
7 | 7 | use LunixREST\Request\URLParser\Exceptions\InvalidRequestURLException; |
8 | 8 | |
9 | -interface RequestFactory |
|
10 | -{ |
|
9 | +interface RequestFactory { |
|
11 | 10 | /** |
12 | 11 | * Creates a request from raw $data and a $url |
13 | 12 | * @param $method |
@@ -9,10 +9,8 @@ |
||
9 | 9 | * Class BasicRequestFactory |
10 | 10 | * @package LunixREST\Request\RequestFactory |
11 | 11 | */ |
12 | -class BasicRequestFactory extends DefaultRequestFactory |
|
13 | -{ |
|
14 | - public function __construct() |
|
15 | - { |
|
12 | +class BasicRequestFactory extends DefaultRequestFactory { |
|
13 | + public function __construct() { |
|
16 | 14 | parent::__construct(new BasicURLParser(new MIMEFileProvider())); |
17 | 15 | } |
18 | 16 | } |
@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | * Class GenericRequestFactory |
15 | 15 | * @package LunixREST\Request\RequestFactory |
16 | 16 | */ |
17 | -class GenericRequestFactory implements RequestFactory |
|
18 | -{ |
|
17 | +class GenericRequestFactory implements RequestFactory { |
|
19 | 18 | |
20 | 19 | /** |
21 | 20 | * @var URLParser |
@@ -36,8 +35,7 @@ discard block |
||
36 | 35 | * @param BodyParserFactory $bodyParserFactory |
37 | 36 | * @param HeaderParser $headerParser |
38 | 37 | */ |
39 | - public function __construct(URLParser $URLParser, BodyParserFactory $bodyParserFactory, HeaderParser $headerParser) |
|
40 | - { |
|
38 | + public function __construct(URLParser $URLParser, BodyParserFactory $bodyParserFactory, HeaderParser $headerParser) { |
|
41 | 39 | $this->URLParser = $URLParser; |
42 | 40 | $this->bodyParserFactory = $bodyParserFactory; |
43 | 41 | $this->headerParser = $headerParser; |
@@ -1,8 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace LunixREST\Request\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\Request\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\Request\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 => $value) { |
49 | 46 | if (strtolower($key) == strtolower($this->apiKeyHeaderKey)) { |
50 | 47 | return $value; |
@@ -53,8 +50,7 @@ discard block |
||
53 | 50 | return null; |
54 | 51 | } |
55 | 52 | |
56 | - protected function getContentType(array $headers) |
|
57 | - { |
|
53 | + protected function getContentType(array $headers) { |
|
58 | 54 | foreach ($headers as $key => $value) { |
59 | 55 | if (strtolower($key) == 'content-type') { |
60 | 56 | return $value; |