Completed
Pull Request — master (#38)
by John
02:23
created
src/Server/Router/EndpointFactory/CachingEndpointFactory.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@  discard block
 block discarded – undo
11 11
  * Class CachingEndpointFactory
12 12
  * @package LunixREST\Server\Router\EndpointFactory
13 13
  */
14
-abstract class CachingEndpointFactory extends LoggingEndpointFactory
15
-{
14
+abstract class CachingEndpointFactory extends LoggingEndpointFactory {
16 15
     /**
17 16
      * @var CacheItemPoolInterface
18 17
      */
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
      * @param CacheItemPoolInterface $cachePool
24 23
      * @param LoggerInterface $logger
25 24
      */
26
-    public function __construct(CacheItemPoolInterface $cachePool, LoggerInterface $logger)
27
-    {
25
+    public function __construct(CacheItemPoolInterface $cachePool, LoggerInterface $logger) {
28 26
         $this->cachePool = $cachePool;
29 27
         parent::__construct($logger);
30 28
     }
Please login to merge, or discard this patch.
src/Server/Router/GenericRouter.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $method = $this->mapEndpointMethod($request);
60 60
         if (!method_exists($endpoint, $method)) {
61
-            throw new MethodNotFoundException("The endpoint method " . $method . " was not found");
61
+            throw new MethodNotFoundException("The endpoint method ".$method." was not found");
62 62
         }
63 63
         return call_user_func([$endpoint, $method], $request);
64 64
     }
@@ -69,6 +69,6 @@  discard block
 block discarded – undo
69 69
      */
70 70
     protected function mapEndpointMethod(APIRequest $request): string
71 71
     {
72
-        return strtolower($request->getMethod()) . (!$request->getElement() ? 'All': '');
72
+        return strtolower($request->getMethod()).(!$request->getElement() ? 'All' : '');
73 73
     }
74 74
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
15 15
  * Class GenericRouter
16 16
  * @package LunixREST\Server\Router
17 17
  */
18
-class GenericRouter implements Router
19
-{
18
+class GenericRouter implements Router {
20 19
     /**
21 20
      * @var EndpointFactory
22 21
      */
@@ -26,8 +25,7 @@  discard block
 block discarded – undo
26 25
      * DefaultRouter constructor.
27 26
      * @param EndpointFactory $endpointFactory
28 27
      */
29
-    public function __construct(EndpointFactory $endpointFactory)
30
-    {
28
+    public function __construct(EndpointFactory $endpointFactory) {
31 29
         $this->endpointFactory = $endpointFactory;
32 30
     }
33 31
 
Please login to merge, or discard this patch.
src/Server/Router/Router.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@
 block discarded – undo
14 14
  * Interface Router
15 15
  * @package LunixREST\Server\Router
16 16
  */
17
-interface Router
18
-{
17
+interface Router {
19 18
     /**
20 19
      * @param APIRequest $request
21 20
      * @return APIResponseData
Please login to merge, or discard this patch.
src/Server/APIRequest/APIRequest.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
     public function __construct(
56 56
         string $method,
57 57
         string $endpoint,
58
-        ?string $element,
58
+        ? string $element,
59 59
         array $acceptableMIMETypes,
60
-        ?string $version,
61
-        ?string $apiKey,
60
+        ? string $version,
61
+        ? string $apiKey,
62 62
         array $queryData,
63 63
         $data
64 64
     ) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     /**
92 92
      * @return null|string
93 93
      */
94
-    public function getElement(): ?string
94
+    public function getElement(): ? string
95 95
     {
96 96
         return $this->element;
97 97
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     /**
108 108
      * @return null|string
109 109
      */
110
-    public function getVersion(): ?string
110
+    public function getVersion(): ? string
111 111
     {
112 112
         return $this->version;
113 113
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     /**
116 116
      * @return null|string
117 117
      */
118
-    public function getApiKey(): ?string
118
+    public function getApiKey(): ? string
119 119
     {
120 120
         return $this->apiKey;
121 121
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@  discard block
 block discarded – undo
6 6
  * Class APIRequest
7 7
  * @package LunixREST\Server\Request
8 8
  */
9
-class APIRequest
10
-{
9
+class APIRequest {
11 10
     /**
12 11
      * @var string
13 12
      */
@@ -131,8 +130,7 @@  discard block
 block discarded – undo
131 130
     /**
132 131
      * @return array|null|object
133 132
      */
134
-    public function getData()
135
-    {
133
+    public function getData() {
136 134
         return $this->data;
137 135
     }
138 136
 }
Please login to merge, or discard this patch.
src/Server/ResponseFactory/ResponseFactory.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@
 block discarded – undo
10 10
  * Interface ResponseFactory
11 11
  * @package LunixREST\Server\ResponseFactory
12 12
  */
13
-interface ResponseFactory
14
-{
13
+interface ResponseFactory {
15 14
     /**
16 15
      * @param APIResponseData $data
17 16
      * @param array $acceptedMIMETypes - acceptable MIME types in order of preference
Please login to merge, or discard this patch.
src/Server/ResponseFactory/RegisteredResponseFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function __construct($responseTypes = [])
22 22
     {
23
-        foreach($responseTypes as $mimeType => $serializer) {
23
+        foreach ($responseTypes as $mimeType => $serializer) {
24 24
             $this->registerSerializer($mimeType, $serializer);
25 25
         }
26 26
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         }
44 44
 
45 45
         foreach ($acceptedMIMETypes as $acceptedMIMEType) {
46
-            if(isset($this->serializers[strtolower($acceptedMIMEType)])) {
46
+            if (isset($this->serializers[strtolower($acceptedMIMEType)])) {
47 47
                 return new APIResponse($acceptedMIMEType, $this->serializers[strtolower($acceptedMIMEType)]->serialize($data));
48 48
             }
49 49
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
  * Class RegisteredResponseFactory
14 14
  * @package LunixREST\Server\ResponseFactory
15 15
  */
16
-class RegisteredResponseFactory implements ResponseFactory
17
-{
16
+class RegisteredResponseFactory implements ResponseFactory {
18 17
     /**
19 18
      * @var APIResponseDataSerializer[]
20 19
      */
@@ -24,8 +23,7 @@  discard block
 block discarded – undo
24 23
      * RegisteredResponseFactory constructor.
25 24
      * @param APIResponseDataSerializer[] $responseTypes
26 25
      */
27
-    public function __construct($responseTypes = [])
28
-    {
26
+    public function __construct($responseTypes = []) {
29 27
         foreach($responseTypes as $mimeType => $serializer) {
30 28
             $this->registerSerializer($mimeType, $serializer);
31 29
         }
@@ -35,8 +33,7 @@  discard block
 block discarded – undo
35 33
      * @param $mimeType
36 34
      * @param APIResponseDataSerializer $dataSerializer
37 35
      */
38
-    public function registerSerializer($mimeType, APIResponseDataSerializer $dataSerializer)
39
-    {
36
+    public function registerSerializer($mimeType, APIResponseDataSerializer $dataSerializer) {
40 37
         $this->serializers[strtolower($mimeType)] = $dataSerializer;
41 38
     }
42 39
 
Please login to merge, or discard this patch.
src/RequestFactory/URLParser/MIMEProvider.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
  * Interface MIMEProvider
9 9
  * @package LunixREST\RequestFactory\URLParser
10 10
  */
11
-interface MIMEProvider
12
-{
11
+interface MIMEProvider {
13 12
     /**
14 13
      * @param string $fileExtension
15 14
      * @return string
Please login to merge, or discard this patch.
src/RequestFactory/URLParser/ParsedURL.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param array $acceptableMIMETypes
43 43
      * @param null|string $queryString
44 44
      */
45
-    public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString)
45
+    public function __construct(string $endpoint, ? string $element, ? string $version, ? string $apiKey, array $acceptableMIMETypes, ? string $queryString)
46 46
     {
47 47
         $this->endpoint = $endpoint;
48 48
         $this->element = $element;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     /**
64 64
      * @return null|string
65 65
      */
66
-    public function getElement(): ?string
66
+    public function getElement(): ? string
67 67
     {
68 68
         return $this->element;
69 69
     }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     /**
72 72
      * @return null|string
73 73
      */
74
-    public function getVersion(): ?string
74
+    public function getVersion(): ? string
75 75
     {
76 76
         return $this->version;
77 77
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * @return null|string
81 81
      */
82
-    public function getApiKey(): ?string
82
+    public function getApiKey(): ? string
83 83
     {
84 84
         return $this->apiKey;
85 85
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@  discard block
 block discarded – undo
6 6
  * Class ParsedURL
7 7
  * @package LunixREST\RequestFactory\URLParser
8 8
  */
9
-class ParsedURL
10
-{
9
+class ParsedURL {
11 10
     /**
12 11
      * @var string
13 12
      */
@@ -42,8 +41,7 @@  discard block
 block discarded – undo
42 41
      * @param array $acceptableMIMETypes
43 42
      * @param null|string $queryString
44 43
      */
45
-    public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString)
46
-    {
44
+    public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString) {
47 45
         $this->endpoint = $endpoint;
48 46
         $this->element = $element;
49 47
         $this->version = $version;
@@ -95,8 +93,7 @@  discard block
 block discarded – undo
95 93
     /**
96 94
      * @return null|string
97 95
      */
98
-    public function getQueryString()
99
-    {
96
+    public function getQueryString() {
100 97
         return $this->queryString;
101 98
     }
102 99
 }
Please login to merge, or discard this patch.
src/RequestFactory/URLParser/Exceptions/UnableToProvideMIMEException.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\RequestFactory\URLParser\Exceptions;
3 3
 
4
-class UnableToProvideMIMEException extends \Exception
5
-{
4
+class UnableToProvideMIMEException extends \Exception {
6 5
 
7 6
 }
Please login to merge, or discard this patch.