Completed
Pull Request — master (#164)
by
unknown
13:40
created
src/ApiDecider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 
53 53
     public function enableGlobalPreflight(?CorsPreflightHandlerInterface $corsHandler = null): void
54 54
     {
55
-        if (!$corsHandler) {
55
+        if ( ! $corsHandler) {
56 56
             $corsHandler = new CorsPreflightHandler(new Response());
57 57
         }
58 58
 
Please login to merge, or discard this patch.
src/Handlers/BaseHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
     protected function getFractal(): Manager
87 87
     {
88
-        if (!$this->fractal) {
88
+        if ( ! $this->fractal) {
89 89
             throw new InvalidStateException("Fractal manager isn't initialized. Did you call parent::__construct() in your handler constructor?");
90 90
         }
91 91
 
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
      */
126 126
     final public function createLink(array $params = []): string
127 127
     {
128
-        if (!$this->linkGenerator) {
128
+        if ( ! $this->linkGenerator) {
129 129
             throw new InvalidStateException('You have setupLinkGenerator for this handler if you want to generate link in this handler');
130 130
         }
131 131
 
132
-        if (!$this->endpoint) {
132
+        if ( ! $this->endpoint) {
133 133
             throw new InvalidStateException('You have setEndpoint() for this handler if you want to generate link in this handler');
134 134
         }
135 135
 
Please login to merge, or discard this patch.
src/Params/GetInputParam.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 
11 11
     public function getValue(): mixed
12 12
     {
13
-        if (!filter_has_var(INPUT_GET, $this->key) && isset($_GET[$this->key])) {
13
+        if ( ! filter_has_var(INPUT_GET, $this->key) && isset($_GET[$this->key])) {
14 14
             return $_GET[$this->key];
15 15
         }
16 16
 
Please login to merge, or discard this patch.
src/Params/PostInputParam.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 
11 11
     public function getValue(): mixed
12 12
     {
13
-        if (!filter_has_var(INPUT_POST, $this->key) && isset($_POST[$this->key])) {
13
+        if ( ! filter_has_var(INPUT_POST, $this->key) && isset($_POST[$this->key])) {
14 14
             return $_POST[$this->key];
15 15
         }
16 16
 
Please login to merge, or discard this patch.
src/Params/CookieInputParam.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 
11 11
     public function getValue(): mixed
12 12
     {
13
-        if (!filter_has_var(INPUT_COOKIE, $this->key) && isset($_COOKIE[$this->key])) {
13
+        if ( ! filter_has_var(INPUT_COOKIE, $this->key) && isset($_COOKIE[$this->key])) {
14 14
             return $_COOKIE[$this->key];
15 15
         }
16 16
 
Please login to merge, or discard this patch.
src/Presenters/ApiPresenter.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                 $outputValid = $outputs === []; // back compatibility for handlers with no outputs defined
108 108
                 $outputValidatorErrors = [];
109 109
                 foreach ($outputs as $output) {
110
-                    if (!$output instanceof OutputInterface) {
110
+                    if ( ! $output instanceof OutputInterface) {
111 111
                         $outputValidatorErrors[] = ['Output does not implement OutputInterface'];
112 112
                         continue;
113 113
                     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                     $outputValidatorErrors[] = $validationResult->getErrors();
122 122
                 }
123 123
 
124
-                if (!$outputValid) {
124
+                if ( ! $outputValid) {
125 125
                     $response = $this->errorHandler->handleSchema($outputValidatorErrors, $params);
126 126
                     $code = $response->getCode();
127 127
                 }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     private function checkAuth(ApiAuthorizationInterface $authorization, array $params): ?IResponse
161 161
     {
162 162
         try {
163
-            if (!$authorization->authorized()) {
163
+            if ( ! $authorization->authorized()) {
164 164
                 $response = $this->errorHandler->handleAuthorization($authorization, $params);
165 165
                 $this->response->setCode($response->getCode());
166 166
                 return $response;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     private function checkRateLimit(RateLimitInterface $rateLimit): ?IResponse
178 178
     {
179 179
         $rateLimitResponse = $rateLimit->check();
180
-        if (!$rateLimitResponse) {
180
+        if ( ! $rateLimitResponse) {
181 181
             return null;
182 182
         }
183 183
 
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
         $remaining = $rateLimitResponse->getRemaining();
186 186
         $retryAfter = $rateLimitResponse->getRetryAfter();
187 187
 
188
-        $this->response->addHeader('X-RateLimit-Limit', (string)$limit);
189
-        $this->response->addHeader('X-RateLimit-Remaining', (string)$remaining);
188
+        $this->response->addHeader('X-RateLimit-Limit', (string) $limit);
189
+        $this->response->addHeader('X-RateLimit-Remaining', (string) $remaining);
190 190
 
191 191
         if ($remaining === 0) {
192 192
             $this->response->setCode(Response::S429_TOO_MANY_REQUESTS);
193
-            $this->response->addHeader('Retry-After', (string)$retryAfter);
193
+            $this->response->addHeader('Retry-After', (string) $retryAfter);
194 194
             return $rateLimitResponse->getErrorResponse() ?: new JsonResponse(['status' => 'error', 'message' => 'Too many requests. Retry after ' . $retryAfter . ' seconds.']);
195 195
         }
196 196
 
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
 
255 255
     private function getRequestDomain(): ?string
256 256
     {
257
-        if (!filter_input(INPUT_SERVER, 'HTTP_REFERER')) {
257
+        if ( ! filter_input(INPUT_SERVER, 'HTTP_REFERER')) {
258 258
             return null;
259 259
         }
260 260
 
261 261
         $refererParsedUrl = parse_url(filter_input(INPUT_SERVER, 'HTTP_REFERER'));
262
-        if (!(isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) {
262
+        if ( ! (isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) {
263 263
             return null;
264 264
         }
265 265
 
Please login to merge, or discard this patch.