Completed
Push — master ( 846411...c8b313 )
by John
01:51
created
src/Server/Server.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param ResponseFactory $responseFactory
41 41
      * @param EndpointFactory $endpointFactory
42 42
      */
43
-    public function __construct(AccessControl $accessControl, Throttle $throttle, ResponseFactory $responseFactory, EndpointFactory $endpointFactory){
43
+    public function __construct(AccessControl $accessControl, Throttle $throttle, ResponseFactory $responseFactory, EndpointFactory $endpointFactory) {
44 44
         $this->accessControl = $accessControl;
45 45
         $this->throttle = $throttle;
46 46
         $this->responseFactory = $responseFactory;
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
      * @param Request $request
81 81
      * @throws InvalidAPIKeyException
82 82
      */
83
-    protected function validateKey(Request $request){
84
-        if(!$this->accessControl->validateKey($request->getApiKey())){
83
+    protected function validateKey(Request $request) {
84
+        if(!$this->accessControl->validateKey($request->getApiKey())) {
85 85
             throw new InvalidAPIKeyException('Invalid API key');
86 86
         }
87 87
     }
Please login to merge, or discard this patch.
src/Server/HTTPServer.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,28 +40,28 @@
 block discarded – undo
40 40
 
41 41
             try {
42 42
                 $response = $this->server->handleRequest($request);
43
-                header("Content-Type: " . $response->getMIMEType());
43
+                header("Content-Type: ".$response->getMIMEType());
44 44
                 echo $response->getAsString();
45
-            } catch(InvalidAPIKeyException $e){
45
+            } catch (InvalidAPIKeyException $e) {
46 46
                 header('400 Bad Request', true, 400);
47
-            } catch(UnknownEndpointException $e){
47
+            } catch (UnknownEndpointException $e) {
48 48
                 header('404 Not Found', true, 404);
49
-            } catch(NotAcceptableResponseTypeException $e){
49
+            } catch (NotAcceptableResponseTypeException $e) {
50 50
                 header('406 Not Acceptable', true, 406);
51
-            } catch(AccessDeniedException $e){
51
+            } catch (AccessDeniedException $e) {
52 52
                 header('403 Access Denied', true, 403);
53
-            } catch(ThrottleLimitExceededException $e){
53
+            } catch (ThrottleLimitExceededException $e) {
54 54
                 header('429 Too Many Requests', true, 429);
55 55
             } catch (\Exception $e) {
56 56
                 header('500 Internal Server Error', true, 500);
57 57
             }
58
-        } catch(InvalidRequestURLException $e){
58
+        } catch (InvalidRequestURLException $e) {
59 59
             header('400 Bad Request', true, 400);
60
-        } catch(UnknownContentTypeException $e){
60
+        } catch (UnknownContentTypeException $e) {
61 61
             header('400 Bad Request', true, 400);
62
-        } catch(InvalidRequestDataException $e){
62
+        } catch (InvalidRequestDataException $e) {
63 63
             header('400 Bad Request', true, 400);
64
-        } catch(\Exception $e){
64
+        } catch (\Exception $e) {
65 65
             header('500 Internal Server Error', true, 500);
66 66
         }
67 67
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,26 +42,26 @@
 block discarded – undo
42 42
                 $response = $this->server->handleRequest($request);
43 43
                 header("Content-Type: " . $response->getMIMEType());
44 44
                 echo $response->getAsString();
45
-            } catch(InvalidAPIKeyException $e){
45
+            } catch(InvalidAPIKeyException $e) {
46 46
                 header('400 Bad Request', true, 400);
47
-            } catch(UnknownEndpointException $e){
47
+            } catch(UnknownEndpointException $e) {
48 48
                 header('404 Not Found', true, 404);
49
-            } catch(NotAcceptableResponseTypeException $e){
49
+            } catch(NotAcceptableResponseTypeException $e) {
50 50
                 header('406 Not Acceptable', true, 406);
51
-            } catch(AccessDeniedException $e){
51
+            } catch(AccessDeniedException $e) {
52 52
                 header('403 Access Denied', true, 403);
53
-            } catch(ThrottleLimitExceededException $e){
53
+            } catch(ThrottleLimitExceededException $e) {
54 54
                 header('429 Too Many Requests', true, 429);
55 55
             } catch (\Exception $e) {
56 56
                 header('500 Internal Server Error', true, 500);
57 57
             }
58
-        } catch(InvalidRequestURLException $e){
58
+        } catch(InvalidRequestURLException $e) {
59 59
             header('400 Bad Request', true, 400);
60
-        } catch(UnknownContentTypeException $e){
60
+        } catch(UnknownContentTypeException $e) {
61 61
             header('400 Bad Request', true, 400);
62
-        } catch(InvalidRequestDataException $e){
62
+        } catch(InvalidRequestDataException $e) {
63 63
             header('400 Bad Request', true, 400);
64
-        } catch(\Exception $e){
64
+        } catch(\Exception $e) {
65 65
             header('500 Internal Server Error', true, 500);
66 66
         }
67 67
     }
Please login to merge, or discard this patch.