@@ -3,8 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use LunixREST\Request\URLParser\Exceptions\InvalidRequestURLException; |
| 5 | 5 | |
| 6 | -interface URLParser |
|
| 7 | -{ |
|
| 6 | +interface URLParser { |
|
| 8 | 7 | /** |
| 9 | 8 | * Parses API request data out of a url |
| 10 | 9 | * @param $url |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace LunixREST\Request\URLParser\Exceptions; |
| 3 | 3 | |
| 4 | -class InvalidRequestURLException extends \Exception |
|
| 5 | -{ |
|
| 4 | +class InvalidRequestURLException extends \Exception { |
|
| 6 | 5 | |
| 7 | 6 | } |
@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | * Class BasicURLParser |
| 12 | 12 | * @package LunixREST\Request\URLParser |
| 13 | 13 | */ |
| 14 | -class BasicURLParser implements URLParser |
|
| 15 | -{ |
|
| 14 | +class BasicURLParser implements URLParser { |
|
| 16 | 15 | |
| 17 | 16 | /** |
| 18 | 17 | * @var MIMEProvider |
@@ -23,8 +22,7 @@ discard block |
||
| 23 | 22 | * BasicURLParser constructor. |
| 24 | 23 | * @param MIMEProvider $MIMEProvider |
| 25 | 24 | */ |
| 26 | - public function __construct(MIMEProvider $MIMEProvider) |
|
| 27 | - { |
|
| 25 | + public function __construct(MIMEProvider $MIMEProvider) { |
|
| 28 | 26 | $this->MIMEProvider = $MIMEProvider; |
| 29 | 27 | } |
| 30 | 28 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param array $acceptableMIMETypes |
| 38 | 38 | * @param null|string $queryString |
| 39 | 39 | */ |
| 40 | - public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString) |
|
| 40 | + public function __construct(string $endpoint, ? string $element, ? string $version, ? string $apiKey, array $acceptableMIMETypes, ? string $queryString) |
|
| 41 | 41 | { |
| 42 | 42 | $this->endpoint = $endpoint; |
| 43 | 43 | $this->element = $element; |
@@ -1,8 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace LunixREST\APIRequest\URLParser; |
| 3 | 3 | |
| 4 | -class ParsedURL |
|
| 5 | -{ |
|
| 4 | +class ParsedURL { |
|
| 6 | 5 | /** |
| 7 | 6 | * @var string |
| 8 | 7 | */ |
@@ -37,8 +36,7 @@ discard block |
||
| 37 | 36 | * @param array $acceptableMIMETypes |
| 38 | 37 | * @param null|string $queryString |
| 39 | 38 | */ |
| 40 | - public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString) |
|
| 41 | - { |
|
| 39 | + public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString) { |
|
| 42 | 40 | $this->endpoint = $endpoint; |
| 43 | 41 | $this->element = $element; |
| 44 | 42 | $this->version = $version; |
@@ -58,24 +56,21 @@ discard block |
||
| 58 | 56 | /** |
| 59 | 57 | * @return null|string |
| 60 | 58 | */ |
| 61 | - public function getElement() |
|
| 62 | - { |
|
| 59 | + public function getElement() { |
|
| 63 | 60 | return $this->element; |
| 64 | 61 | } |
| 65 | 62 | |
| 66 | 63 | /** |
| 67 | 64 | * @return null|string |
| 68 | 65 | */ |
| 69 | - public function getVersion() |
|
| 70 | - { |
|
| 66 | + public function getVersion() { |
|
| 71 | 67 | return $this->version; |
| 72 | 68 | } |
| 73 | 69 | |
| 74 | 70 | /** |
| 75 | 71 | * @return null|string |
| 76 | 72 | */ |
| 77 | - public function getApiKey() |
|
| 78 | - { |
|
| 73 | + public function getApiKey() { |
|
| 79 | 74 | return $this->apiKey; |
| 80 | 75 | } |
| 81 | 76 | |
@@ -90,8 +85,7 @@ discard block |
||
| 90 | 85 | /** |
| 91 | 86 | * @return null|string |
| 92 | 87 | */ |
| 93 | - public function getQueryString() |
|
| 94 | - { |
|
| 88 | + public function getQueryString() { |
|
| 95 | 89 | return $this->queryString; |
| 96 | 90 | } |
| 97 | 91 | } |
@@ -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,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; |
@@ -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 | } |
@@ -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 | |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | use LunixREST\Request\BodyParser\BodyParser; |
| 5 | 5 | use LunixREST\Request\BodyParser\BodyParserFactory\Exceptions\UnknownContentTypeException; |
| 6 | 6 | |
| 7 | -interface BodyParserFactory |
|
| 8 | -{ |
|
| 7 | +interface BodyParserFactory { |
|
| 9 | 8 | /** |
| 10 | 9 | * Parses API request data out of a url |
| 11 | 10 | * @param string $contentType |