@@ -15,8 +15,7 @@ |
||
15 | 15 | * Interface Server |
16 | 16 | * @package LunixREST\Server |
17 | 17 | */ |
18 | -interface Server |
|
19 | -{ |
|
18 | +interface Server { |
|
20 | 19 | /** |
21 | 20 | * @param APIRequest $request |
22 | 21 | * @return APIResponse |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $this->config = parse_ini_file($filename, true); |
25 | 25 | |
26 | 26 | if ($this->config === false) { |
27 | - throw new INIParseException('Could not parse: ' . $filename, true); |
|
27 | + throw new INIParseException('Could not parse: '.$filename, true); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 |
@@ -8,8 +8,7 @@ discard block |
||
8 | 8 | * Class INIConfiguration |
9 | 9 | * @package LunixREST\Configuration |
10 | 10 | */ |
11 | -class INIConfiguration implements Configuration |
|
12 | -{ |
|
11 | +class INIConfiguration implements Configuration { |
|
13 | 12 | /** |
14 | 13 | * @var |
15 | 14 | */ |
@@ -19,8 +18,7 @@ discard block |
||
19 | 18 | * @param string $filename |
20 | 19 | * @throws INIParseException |
21 | 20 | */ |
22 | - public function __construct($filename) |
|
23 | - { |
|
21 | + public function __construct($filename) { |
|
24 | 22 | $this->config = parse_ini_file($filename, true); |
25 | 23 | |
26 | 24 | if ($this->config === false) { |
@@ -33,8 +31,7 @@ discard block |
||
33 | 31 | * @param $namespace |
34 | 32 | * @return mixed |
35 | 33 | */ |
36 | - public function get($key, $namespace) |
|
37 | - { |
|
34 | + public function get($key, $namespace) { |
|
38 | 35 | return $this->config[$namespace][$key] ?? null; |
39 | 36 | } |
40 | 37 |
@@ -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 |
@@ -6,7 +6,6 @@ |
||
6 | 6 | * Class INIParseException |
7 | 7 | * @package LunixREST\Configuration\Exceptions |
8 | 8 | */ |
9 | -class INIParseException extends \Exception |
|
10 | -{ |
|
9 | +class INIParseException extends \Exception { |
|
11 | 10 | |
12 | 11 | } |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | * Class GenericServer |
22 | 22 | * @package LunixREST\Server |
23 | 23 | */ |
24 | -class GenericServer implements Server |
|
25 | -{ |
|
24 | +class GenericServer implements Server { |
|
26 | 25 | /** |
27 | 26 | * @var AccessControl |
28 | 27 | */ |
@@ -96,8 +95,7 @@ discard block |
||
96 | 95 | * @param APIRequest $request |
97 | 96 | * @throws InvalidAPIKeyException |
98 | 97 | */ |
99 | - protected function validateKey(APIRequest $request) |
|
100 | - { |
|
98 | + protected function validateKey(APIRequest $request) { |
|
101 | 99 | if (!$this->accessControl->validateKey($request->getApiKey())) { |
102 | 100 | throw new InvalidAPIKeyException('Invalid API key'); |
103 | 101 | } |
@@ -107,8 +105,7 @@ discard block |
||
107 | 105 | * @param APIRequest $request |
108 | 106 | * @throws NotAcceptableResponseTypeException |
109 | 107 | */ |
110 | - protected function validateAcceptableMIMETypes(APIRequest $request) |
|
111 | - { |
|
108 | + protected function validateAcceptableMIMETypes(APIRequest $request) { |
|
112 | 109 | $supportedFormats = $this->responseFactory->getSupportedMIMETypes(); |
113 | 110 | $requestedFormats = $request->getAcceptableMIMETypes(); |
114 | 111 |
@@ -8,8 +8,7 @@ discard block |
||
8 | 8 | * Class APIResponse |
9 | 9 | * @package LunixREST\Server\APIResponse |
10 | 10 | */ |
11 | -class APIResponse |
|
12 | -{ |
|
11 | +class APIResponse { |
|
13 | 12 | /** |
14 | 13 | * @var string |
15 | 14 | */ |
@@ -19,8 +18,7 @@ discard block |
||
19 | 18 | */ |
20 | 19 | protected $stream; |
21 | 20 | |
22 | - public function __construct(string $MIMEType, StreamInterface $stream) |
|
23 | - { |
|
21 | + public function __construct(string $MIMEType, StreamInterface $stream) { |
|
24 | 22 | $this->MIMEType = $MIMEType; |
25 | 23 | $this->stream = $stream; |
26 | 24 | } |
@@ -8,8 +8,7 @@ |
||
8 | 8 | * APIResponseData constructor. |
9 | 9 | * @param null|object|array $data |
10 | 10 | */ |
11 | - public function __construct($data) |
|
12 | - { |
|
11 | + public function __construct($data) { |
|
13 | 12 | $this->data = $data; |
14 | 13 | } |
15 | 14 |
@@ -57,7 +57,7 @@ |
||
57 | 57 | { |
58 | 58 | $item = $this->cacheItemPool->getItem($this->deriveCacheKey($request)); |
59 | 59 | |
60 | - if($requestCount = $item->get()) { |
|
60 | + if ($requestCount = $item->get()) { |
|
61 | 61 | $item->set($requestCount + 1); |
62 | 62 | } else { |
63 | 63 | $item->set(1)->expiresAfter($this->perXSeconds); |
@@ -9,8 +9,7 @@ discard block |
||
9 | 9 | * Class CachePoolThrottle |
10 | 10 | * @package LunixREST\Server\Throttle |
11 | 11 | */ |
12 | -abstract class CachePoolThrottle implements Throttle |
|
13 | -{ |
|
12 | +abstract class CachePoolThrottle implements Throttle { |
|
14 | 13 | /** |
15 | 14 | * @var CacheItemPoolInterface |
16 | 15 | */ |
@@ -30,8 +29,7 @@ discard block |
||
30 | 29 | * @param int $limit |
31 | 30 | * @param int $perXSeconds |
32 | 31 | */ |
33 | - public function __construct(CacheItemPoolInterface $cacheItemPool, int $limit = 60, int $perXSeconds = 60) |
|
34 | - { |
|
32 | + public function __construct(CacheItemPoolInterface $cacheItemPool, int $limit = 60, int $perXSeconds = 60) { |
|
35 | 33 | $this->cacheItemPool = $cacheItemPool; |
36 | 34 | $this->limit = $limit; |
37 | 35 | $this->perXSeconds = $perXSeconds; |
@@ -8,8 +8,7 @@ |
||
8 | 8 | * Class NoThrottle |
9 | 9 | * @package LunixREST\Server\Throttle |
10 | 10 | */ |
11 | -class NoThrottle implements Throttle |
|
12 | -{ |
|
11 | +class NoThrottle implements Throttle { |
|
13 | 12 | /** |
14 | 13 | * Never throttle |
15 | 14 | * @param \LunixREST\Server\APIRequest\APIRequest $request |