Completed
Push — master ( beb3fd...91a3d1 )
by John
02:45
created
src/Server/AccessControl/KeyRepositoryAccessControl.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 KeyRepositoryAccessControl
9 9
  * @package LunixREST\Server\AccessControl
10 10
  */
11
-abstract class KeyRepositoryAccessControl implements AccessControl
12
-{
11
+abstract class KeyRepositoryAccessControl implements AccessControl {
13 12
     /**
14 13
      * @var KeyRepository
15 14
      */
@@ -19,8 +18,7 @@  discard block
 block discarded – undo
19 18
      * KeyRepositoryAccessControl constructor.
20 19
      * @param KeyRepository $keyRepository
21 20
      */
22
-    public function __construct(KeyRepository $keyRepository)
23
-    {
21
+    public function __construct(KeyRepository $keyRepository) {
24 22
         $this->keyRepository = $keyRepository;
25 23
     }
26 24
 
Please login to merge, or discard this patch.
src/Server/GenericRouterGenericServer.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@
 block discarded – undo
28 28
  * Class GenericRouterGenericServer
29 29
  * @package LunixREST\Server
30 30
  */
31
-class GenericRouterGenericServer extends GenericServer
32
-{
31
+class GenericRouterGenericServer extends GenericServer {
33 32
     /**
34 33
      * GenericRouterGenericServer constructor.
35 34
      * @param AccessControl $accessControl
Please login to merge, or discard this patch.
src/GenericRouterGenericServerHTTPServer.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 
29 29
     protected function handleServerException(UnableToHandleRequestException $exception, ResponseInterface $response): ResponseInterface
30 30
     {
31
-        if($exception instanceof InvalidRequestException) {
31
+        if ($exception instanceof InvalidRequestException) {
32 32
             $this->logCaughtThrowableResultingInHTTPCode(400, $exception, LogLevel::INFO);
33 33
             return $response->withStatus(400, "Bad Request");
34 34
 
35
-        } elseif(
35
+        } elseif (
36 36
             $exception instanceof ElementNotFoundException ||
37 37
             $exception instanceof UnsupportedMethodException ||
38 38
             $exception instanceof UnableToCreateEndpointException
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
             $this->logCaughtThrowableResultingInHTTPCode(404, $exception, LogLevel::INFO);
41 41
             return $response->withStatus(404, "Not Found");
42 42
 
43
-        } elseif($exception instanceof ElementConflictException) {
43
+        } elseif ($exception instanceof ElementConflictException) {
44 44
             $this->logCaughtThrowableResultingInHTTPCode(409, $exception, LogLevel::NOTICE);
45 45
             return $response->withStatus(409, "Conflict");
46 46
 
47
-        } elseif(
47
+        } elseif (
48 48
             $exception instanceof MethodNotFoundException ||
49 49
             $exception instanceof EndpointExecutionException
50 50
         ) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,10 +19,8 @@
 block discarded – undo
19 19
  * Class GenericRouterGenericServerHTTPServer
20 20
  * @package LunixREST
21 21
  */
22
-class GenericRouterGenericServerHTTPServer extends GenericServerHTTPServer
23
-{
24
-    public function __construct(GenericRouterGenericServer $server, RequestFactory $requestFactory, LoggerInterface $logger)
25
-    {
22
+class GenericRouterGenericServerHTTPServer extends GenericServerHTTPServer {
23
+    public function __construct(GenericRouterGenericServer $server, RequestFactory $requestFactory, LoggerInterface $logger) {
26 24
         parent::__construct($server, $requestFactory, $logger);
27 25
     }
28 26
 
Please login to merge, or discard this patch.
src/GenericServerHTTPServer.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,19 +39,19 @@
 block discarded – undo
39 39
      */
40 40
     protected function handleServerException(UnableToHandleRequestException $exception, ResponseInterface $response): ResponseInterface
41 41
     {
42
-        if($exception instanceof InvalidAPIKeyException || $exception instanceof AccessDeniedException) {
42
+        if ($exception instanceof InvalidAPIKeyException || $exception instanceof AccessDeniedException) {
43 43
             $this->logCaughtThrowableResultingInHTTPCode(403, $exception, LogLevel::NOTICE);
44 44
             return $response->withStatus(403, "Access Denied");
45 45
 
46
-        } elseif($exception instanceof ThrottleLimitExceededException) {
46
+        } elseif ($exception instanceof ThrottleLimitExceededException) {
47 47
             $this->logCaughtThrowableResultingInHTTPCode(429, $exception, LogLevel::WARNING);
48 48
             return $response->withStatus(429, "Too Many Requests");
49 49
 
50
-        } elseif($exception instanceof NotAcceptableResponseTypeException) {
50
+        } elseif ($exception instanceof NotAcceptableResponseTypeException) {
51 51
             $this->logCaughtThrowableResultingInHTTPCode(406, $exception, LogLevel::INFO);
52 52
             return $response->withStatus(406, "Not Acceptable");
53 53
 
54
-        } elseif(
54
+        } elseif (
55 55
             $exception instanceof UnableToCreateAPIResponseException ||
56 56
             $exception instanceof UnableToRouteRequestException
57 57
         ) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,16 +19,14 @@
 block discarded – undo
19 19
  * Class GenericServerHTTPServer
20 20
  * @package LunixREST
21 21
  */
22
-class GenericServerHTTPServer extends HTTPServer
23
-{
22
+class GenericServerHTTPServer extends HTTPServer {
24 23
     /**
25 24
      * GenericServerHTTPServer constructor.
26 25
      * @param GenericServer $server
27 26
      * @param RequestFactory $requestFactory
28 27
      * @param LoggerInterface $logger
29 28
      */
30
-    public function __construct(GenericServer $server, RequestFactory $requestFactory, LoggerInterface $logger)
31
-    {
29
+    public function __construct(GenericServer $server, RequestFactory $requestFactory, LoggerInterface $logger) {
32 30
         parent::__construct($server, $requestFactory, $logger);
33 31
     }
34 32
 
Please login to merge, or discard this patch.
Server/Router/Endpoint/ResourceEndpoint/ArrayResourceParametersFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
      */
53 53
     private static function checkRequestDataIsArray($requestData): void
54 54
     {
55
-        if(!is_array($requestData)) {
55
+        if (!is_array($requestData)) {
56 56
             throw new UnableToCreateResourceParametersException("Unable to read request as array or null");
57 57
         }
58 58
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@
 block discarded – undo
9 9
  * Class ArrayResourceParametersFactory
10 10
  * @package LunixREST\Server\Router\Endpoint\ResourceEndpoint
11 11
  */
12
-abstract class ArrayResourceParametersFactory implements ResourceParametersFactory
13
-{
12
+abstract class ArrayResourceParametersFactory implements ResourceParametersFactory {
14 13
     /**
15 14
      * @param APIRequest $request
16 15
      * @return ResourceParameters
Please login to merge, or discard this patch.
ResourceEndpoint/Exceptions/UnableToCreateResourceParametersException.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 LunixREST\Server\Router\Endpoint\Exceptions\InvalidRequestException;
5 5
 
6
-class UnableToCreateResourceParametersException extends InvalidRequestException
7
-{
6
+class UnableToCreateResourceParametersException extends InvalidRequestException {
8 7
 
9 8
 }
Please login to merge, or discard this patch.
ResourceEndpoint/Exceptions/UnableToCreateAPIResponseDataException.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 LunixREST\Server\Router\Endpoint\Exceptions\EndpointExecutionException;
5 5
 
6
-class UnableToCreateAPIResponseDataException extends EndpointExecutionException
7
-{
6
+class UnableToCreateAPIResponseDataException extends EndpointExecutionException {
8 7
 
9 8
 }
Please login to merge, or discard this patch.
Server/Router/Endpoint/ResourceEndpoint/ResourceAPIResponseDataFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      * @return APIResponseData
16 16
      * @throws UnableToCreateAPIResponseDataException
17 17
      */
18
-    abstract public function toAPIResponseData(?Resource $resource): APIResponseData;
18
+    abstract public function toAPIResponseData(? Resource $resource) : APIResponseData;
19 19
 
20 20
     /**
21 21
      * Uses above method for each resource, extracting the data into an array, creating a new APIResponseData from that array.
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
      * @return APIResponseData
24 24
      * @throws UnableToCreateAPIResponseDataException
25 25
      */
26
-    public function multipleToAPIResponseData(?array $resources): APIResponseData
26
+    public function multipleToAPIResponseData(? array $resources) : APIResponseData
27 27
     {
28
-        if(is_null($resources)) {
28
+        if (is_null($resources)) {
29 29
             return $this->toAPIResponseData(null);
30 30
         }
31 31
 
Please login to merge, or discard this patch.
src/Server/Router/Endpoint/ResourceEndpoint/ResourceParametersFactory.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 ResourceParametersFactory
9 9
  * @package LunixREST\Server\Router\Endpoint\ResourceEndpoint
10 10
  */
11
-interface ResourceParametersFactory
12
-{
11
+interface ResourceParametersFactory {
13 12
     /**
14 13
      * @param APIRequest $request
15 14
      * @return ResourceParameters
Please login to merge, or discard this patch.