Completed
Push — master ( 5ddc50...8d892a )
by John
02:13
created
src/APIRequest/RequestFactory/GenericRequestFactory.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@
 block discarded – undo
28 28
      * @param URLParser $URLParser
29 29
      * @param HeaderParser $headerParser
30 30
      */
31
-    public function __construct(URLParser $URLParser, HeaderParser $headerParser)
32
-    {
31
+    public function __construct(URLParser $URLParser, HeaderParser $headerParser) {
33 32
         $this->URLParser = $URLParser;
34 33
         $this->headerParser = $headerParser;
35 34
     }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@
 block discarded – undo
48 48
         $parsedHeaders = $this->headerParser->parse($serverRequest->getHeaders());
49 49
 
50 50
         $urlQueryData = [];
51
-        if($urlQueryString = $parsedURL->getQueryString()) {
51
+        if ($urlQueryString = $parsedURL->getQueryString()) {
52 52
             parse_str($urlQueryString, $urlQueryData);
53 53
         }
54 54
 
55 55
         $apiKey = $parsedURL->getAPIKey();
56
-        if($apiKey === null) {
56
+        if ($apiKey === null) {
57 57
             $apiKey = $parsedHeaders->getAPIKey();
58 58
         }
59 59
 
Please login to merge, or discard this patch.
src/APIRequest/HeaderParser/DefaultHeaderParser.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     {
48 48
         foreach ($headers as $key => $values) {
49 49
             if (strtolower($key) == strtolower($this->apiKeyHeaderKey)) {
50
-                foreach($values as $value) {
50
+                foreach ($values as $value) {
51 51
                     return $value;
52 52
                 }
53 53
             }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,8 +1,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
src/Server/GenericRouter.php 2 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@  discard block
 block discarded – undo
10 10
  * Class GenericRouter
11 11
  * @package LunixREST\Server
12 12
  */
13
-class GenericRouter implements Router
14
-{
13
+class GenericRouter implements Router {
15 14
     /**
16 15
      * @var EndpointFactory
17 16
      */
@@ -21,8 +20,7 @@  discard block
 block discarded – undo
21 20
      * DefaultRouter constructor.
22 21
      * @param EndpointFactory $endpointFactory
23 22
      */
24
-    public function __construct(EndpointFactory $endpointFactory)
25
-    {
23
+    public function __construct(EndpointFactory $endpointFactory) {
26 24
         $this->endpointFactory = $endpointFactory;
27 25
     }
28 26
 
@@ -31,8 +29,7 @@  discard block
 block discarded – undo
31 29
      * @return null|object|array
32 30
      * @throws MethodNotFoundException
33 31
      */
34
-    public function route(APIRequest $request)
35
-    {
32
+    public function route(APIRequest $request) {
36 33
         $endpoint = $this->endpointFactory->getEndpoint($request->getEndpoint(), $request->getVersion());
37 34
         return $this->executeEndpoint($endpoint, $request);
38 35
     }
@@ -43,8 +40,7 @@  discard block
 block discarded – undo
43 40
      * @return null|object|array
44 41
      * @throws MethodNotFoundException
45 42
      */
46
-    protected function executeEndpoint(Endpoint $endpoint, APIRequest $request)
47
-    {
43
+    protected function executeEndpoint(Endpoint $endpoint, APIRequest $request) {
48 44
         $method = $this->mapEndpointMethod($request);
49 45
         if (!method_exists($endpoint, $method)) {
50 46
             throw new MethodNotFoundException("The endpoint method " . $method . " was not found");
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@
 block discarded – undo
47 47
     {
48 48
         $method = $this->mapEndpointMethod($request);
49 49
         if (!method_exists($endpoint, $method)) {
50
-            throw new MethodNotFoundException("The endpoint method " . $method . " was not found");
50
+            throw new MethodNotFoundException("The endpoint method ".$method." was not found");
51 51
         }
52 52
         return call_user_func([$endpoint, $method], $request);
53 53
     }
54 54
 
55 55
     protected function mapEndpointMethod(APIRequest $request): string
56 56
     {
57
-        return strtolower($request->getMethod()) . (!$request->getElement() ? 'All': '');
57
+        return strtolower($request->getMethod()).(!$request->getElement() ? 'All' : '');
58 58
     }
59 59
 }
Please login to merge, or discard this patch.
src/Endpoint/LoggingEndpoint.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 
4 4
 use Psr\Log\LoggerAwareTrait;
5 5
 
6
-abstract class LoggingEndpoint implements Endpoint
7
-{
6
+abstract class LoggingEndpoint implements Endpoint {
8 7
     use LoggerAwareTrait;
9 8
 }
Please login to merge, or discard this patch.
src/Endpoint/LoggingEndpointFactory.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
  * Class LoggingEndpointFactory
8 8
  * @package LunixREST\Endpoint
9 9
  */
10
-abstract class LoggingEndpointFactory implements EndpointFactory
11
-{
10
+abstract class LoggingEndpointFactory implements EndpointFactory {
12 11
     /**
13 12
      * @var LoggerInterface
14 13
      */
@@ -18,8 +17,7 @@  discard block
 block discarded – undo
18 17
      * LoggingEndpointFactory constructor.
19 18
      * @param LoggerInterface $logger
20 19
      */
21
-    public function __construct(LoggerInterface $logger)
22
-    {
20
+    public function __construct(LoggerInterface $logger) {
23 21
         $this->logger = $logger;
24 22
     }
25 23
 
Please login to merge, or discard this patch.
src/Endpoint/CachingEndpointFactory.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@  discard block
 block discarded – undo
8 8
  * Class CachingEndpointFactory
9 9
  * @package LunixREST\Endpoint
10 10
  */
11
-abstract class CachingEndpointFactory extends LoggingEndpointFactory
12
-{
11
+abstract class CachingEndpointFactory extends LoggingEndpointFactory {
13 12
     /**
14 13
      * @var CacheItemPoolInterface
15 14
      */
@@ -20,8 +19,7 @@  discard block
 block discarded – undo
20 19
      * @param CacheItemPoolInterface $cachePool
21 20
      * @param LoggerInterface $logger
22 21
      */
23
-    public function __construct(CacheItemPoolInterface $cachePool, LoggerInterface $logger)
24
-    {
22
+    public function __construct(CacheItemPoolInterface $cachePool, LoggerInterface $logger) {
25 23
         $this->cachePool = $cachePool;
26 24
         parent::__construct($logger);
27 25
     }
Please login to merge, or discard this patch.
src/Endpoint/CachingEndpoint.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
  * Class CachingEndpoint
8 8
  * @package LunixREST\Endpoint
9 9
  */
10
-abstract class CachingEndpoint extends LoggingEndpoint
11
-{
10
+abstract class CachingEndpoint extends LoggingEndpoint {
12 11
     /**
13 12
      * @var CacheItemPoolInterface
14 13
      */
@@ -17,8 +16,7 @@  discard block
 block discarded – undo
17 16
     /**
18 17
      * @param CacheItemPoolInterface $cacheItemPool
19 18
      */
20
-    public function setCachePool(CacheItemPoolInterface $cacheItemPool)
21
-    {
19
+    public function setCachePool(CacheItemPoolInterface $cacheItemPool) {
22 20
         $this->cachePool = $cacheItemPool;
23 21
     }
24 22
 }
Please login to merge, or discard this patch.
src/Configuration/INIConfiguration.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/APIResponse/Exceptions/NotAcceptableResponseTypeException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace LunixREST\APIResponse\Exceptions;
3 3
 
4
-class NotAcceptableResponseTypeException extends \Exception
5
-{
4
+class NotAcceptableResponseTypeException extends \Exception {
6 5
 
7 6
 }
Please login to merge, or discard this patch.