Completed
Pull Request — master (#165)
by
unknown
11:58
created
rector.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@
 block discarded – undo
23 23
         \Rector\DeadCode\Rector\PropertyProperty\RemoveNullPropertyInitializationRector::class,
24 24
         \Rector\EarlyReturn\Rector\StmtsAwareInterface\ReturnEarlyIfVariableRector::class,
25 25
     ])
26
-     ->withSets([
27
-         LevelSetList::UP_TO_PHP_71,
28
-         SetList::DEAD_CODE,
29
-         SetList::CODING_STYLE,
30
-         SetList::EARLY_RETURN,
31
-     ]);
32 26
\ No newline at end of file
27
+        ->withSets([
28
+            LevelSetList::UP_TO_PHP_71,
29
+            SetList::DEAD_CODE,
30
+            SetList::CODING_STYLE,
31
+            SetList::EARLY_RETURN,
32
+        ]);
33 33
\ No newline at end of file
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
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 $outputValid = count($outputs) === 0; // back compatibility for handlers with no outputs defined
104 104
                 $outputValidatorErrors = [];
105 105
                 foreach ($outputs as $output) {
106
-                    if (!$output instanceof OutputInterface) {
106
+                    if ( ! $output instanceof OutputInterface) {
107 107
                         $outputValidatorErrors[] = ["Output does not implement OutputInterface"];
108 108
                         continue;
109 109
                     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                     $outputValidatorErrors[] = $validationResult->getErrors();
118 118
                 }
119 119
 
120
-                if (!$outputValid) {
120
+                if ( ! $outputValid) {
121 121
                     $response = $this->errorHandler->handleSchema($outputValidatorErrors, $params);
122 122
                     $code = $response->getCode();
123 123
                 }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     private function checkAuth(ApiAuthorizationInterface $authorization, array $params): ?IResponse
154 154
     {
155 155
         try {
156
-            if (!$authorization->authorized()) {
156
+            if ( ! $authorization->authorized()) {
157 157
                 $response = $this->errorHandler->handleAuthorization($authorization, $params);
158 158
                 $this->response->setCode($response->getCode());
159 159
                 return $response;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     private function checkRateLimit(RateLimitInterface $rateLimit): ?IResponse
171 171
     {
172 172
         $rateLimitResponse = $rateLimit->check();
173
-        if (!$rateLimitResponse) {
173
+        if ( ! $rateLimitResponse) {
174 174
             return null;
175 175
         }
176 176
 
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
         $remaining = $rateLimitResponse->getRemaining();
179 179
         $retryAfter = $rateLimitResponse->getRetryAfter();
180 180
 
181
-        $this->response->addHeader('X-RateLimit-Limit', (string)$limit);
182
-        $this->response->addHeader('X-RateLimit-Remaining', (string)$remaining);
181
+        $this->response->addHeader('X-RateLimit-Limit', (string) $limit);
182
+        $this->response->addHeader('X-RateLimit-Remaining', (string) $remaining);
183 183
 
184 184
         if ($remaining === 0) {
185 185
             $this->response->setCode(Response::S429_TOO_MANY_REQUESTS);
186
-            $this->response->addHeader('Retry-After', (string)$retryAfter);
186
+            $this->response->addHeader('Retry-After', (string) $retryAfter);
187 187
             return $rateLimitResponse->getErrorResponse() ?: new JsonResponse(['status' => 'error', 'message' => 'Too many requests. Retry after ' . $retryAfter . ' seconds.']);
188 188
         }
189 189
 
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
 
248 248
     private function getRequestDomain(): ?string
249 249
     {
250
-        if (!filter_input(INPUT_SERVER, 'HTTP_REFERER')) {
250
+        if ( ! filter_input(INPUT_SERVER, 'HTTP_REFERER')) {
251 251
             return null;
252 252
         }
253 253
 
254 254
         $refererParsedUrl = parse_url(filter_input(INPUT_SERVER, 'HTTP_REFERER'));
255
-        if (!(isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) {
255
+        if ( ! (isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) {
256 256
             return null;
257 257
         }
258 258
 
Please login to merge, or discard this patch.
src/Output/JsonOutput.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 
23 23
     public function validate(ResponseInterface $response): ValidationResultInterface
24 24
     {
25
-        if (!$response instanceof JsonApiResponse) {
25
+        if ( ! $response instanceof JsonApiResponse) {
26 26
             return new ValidationResult(ValidationResult::STATUS_ERROR);
27 27
         }
28 28
 
Please login to merge, or discard this patch.
src/Output/RedirectOutput.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 {
14 14
     public function validate(ResponseInterface $response): ValidationResultInterface
15 15
     {
16
-        if (!$response instanceof RedirectResponse) {
16
+        if ( ! $response instanceof RedirectResponse) {
17 17
             return new ValidationResult(ValidationResult::STATUS_ERROR);
18 18
         }
19 19
 
Please login to merge, or discard this patch.
src/Authorization/BearerTokenAuthorization.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 class BearerTokenAuthorization extends TokenAuthorization
11 11
 {
12
-   /**
12
+    /**
13 13
      * BearerTokenAuthorization constructor.
14 14
      */
15 15
     public function __construct(TokenRepositoryInterface $tokenRepository, IpDetectorInterface $ipDetector)
Please login to merge, or discard this patch.
src/Authorization/BasicAuthentication.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     {
31 31
         $urlScript = $this->httpRequest->getUrl();
32 32
         $authentication = $this->authentications[$urlScript->getUser()] ?? null;
33
-        if (!$authentication) {
33
+        if ( ! $authentication) {
34 34
             return false;
35 35
         }
36 36
 
Please login to merge, or discard this patch.
src/Authorization/TokenAuthorization.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
         }
42 42
 
43 43
         $result = $this->tokenRepository->validToken($token);
44
-        if (!$result) {
44
+        if ( ! $result) {
45 45
             $this->errorMessage = 'Token doesn\'t exists or isn\'t active';
46 46
             return false;
47 47
         }
48 48
 
49
-        if (!$this->isValidIp($this->tokenRepository->ipRestrictions($token))) {
49
+        if ( ! $this->isValidIp($this->tokenRepository->ipRestrictions($token))) {
50 50
             $this->errorMessage = 'Invalid IP';
51 51
             return false;
52 52
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         [$range, $netmask] = explode('/', $range, 2);
110 110
         $range_decimal = ip2long($range);
111 111
         $ipDecimal = ip2long($ip);
112
-        $wildcard_decimal = 2 ** (32 - (int)$netmask) - 1;
112
+        $wildcard_decimal = 2 ** (32 - (int) $netmask) - 1;
113 113
         $netmask_decimal = ~ $wildcard_decimal;
114 114
         return (($ipDecimal & $netmask_decimal) === ($range_decimal & $netmask_decimal));
115 115
     }
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
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
     protected function getFractal(): Manager
86 86
     {
87
-        if (!$this->fractal) {
87
+        if ( ! $this->fractal) {
88 88
             throw new InvalidStateException("Fractal manager isn't initialized. Did you call parent::__construct() in your handler constructor?");
89 89
         }
90 90
 
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
      */
124 124
     final public function createLink(array $params = []): string
125 125
     {
126
-        if (!$this->linkGenerator) {
126
+        if ( ! $this->linkGenerator) {
127 127
             throw new InvalidStateException("You have setupLinkGenerator for this handler if you want to generate link in this handler");
128 128
         }
129 129
 
130
-        if (!$this->endpoint) {
130
+        if ( ! $this->endpoint) {
131 131
             throw new InvalidStateException("You have setEndpoint() for this handler if you want to generate link in this handler");
132 132
         }
133 133
 
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()
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.