Completed
Push — master ( b42d28...032cff )
by John
01:51
created
src/Server/Server.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param ResponseFactory $responseFactory
39 39
      * @param EndpointFactory $endpointFactory
40 40
      */
41
-    public function __construct(AccessControl $accessControl, Throttle $throttle, ResponseFactory $responseFactory, EndpointFactory $endpointFactory){
41
+    public function __construct(AccessControl $accessControl, Throttle $throttle, ResponseFactory $responseFactory, EndpointFactory $endpointFactory) {
42 42
         $this->accessControl = $accessControl;
43 43
         $this->throttle = $throttle;
44 44
         $this->responseFactory = $responseFactory;
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 
59 59
         $this->validateExtension($request);
60 60
 
61
-        if($this->throttle->shouldThrottle($request)) {
61
+        if ($this->throttle->shouldThrottle($request)) {
62 62
             throw new ThrottleLimitExceededException('Request limit exceeded');
63 63
         }
64 64
 
65
-        if(!$this->accessControl->validateAccess($request)) {
65
+        if (!$this->accessControl->validateAccess($request)) {
66 66
             throw new AccessDeniedException("API key does not have the required permissions to access requested resource");
67 67
         }
68 68
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
      * @param Request $request
78 78
      * @throws InvalidAPIKeyException
79 79
      */
80
-    protected function validateKey(Request $request){
81
-        if(!$this->accessControl->validateKey($request->getApiKey())){
80
+    protected function validateKey(Request $request) {
81
+        if (!$this->accessControl->validateKey($request->getApiKey())) {
82 82
             throw new InvalidAPIKeyException('Invalid API key');
83 83
         }
84 84
     }
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
      */
90 90
     protected function validateExtension(Request $request) {
91 91
         $formats = $this->responseFactory->getSupportedTypes();
92
-        if(empty($formats) || !in_array($request->getExtension(), $formats)){
93
-            throw new UnknownResponseTypeException('Unknown response format: ' . $request->getExtension());
92
+        if (empty($formats) || !in_array($request->getExtension(), $formats)) {
93
+            throw new UnknownResponseTypeException('Unknown response format: '.$request->getExtension());
94 94
         }
95 95
     }
96 96
 }
Please login to merge, or discard this patch.