Completed
Pull Request — master (#61)
by Michal
02:07
created
src/Misc/ConsoleRequest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@
 block discarded – undo
190 190
                 $counter = 0;
191 191
                 foreach ($value as $innerValue) {
192 192
                     if ($innerValue != null) {
193
-                        $result[$key . "[".$counter++."]"] = $innerValue;
193
+                        $result[$key . "[" . $counter++ . "]"] = $innerValue;
194 194
                     }
195 195
                 }
196 196
             } else {
Please login to merge, or discard this patch.
src/Handlers/ApiListingHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     private function getApiList(int $version): array
55 55
     {
56
-        $versionApis = array_filter($this->apiDecider->getApis(), function (Api $api) use ($version) {
56
+        $versionApis = array_filter($this->apiDecider->getApis(), function(Api $api) use ($version) {
57 57
             return $version == $api->getEndpoint()->getVersion();
58 58
         });
59 59
 
60
-        return array_map(function (Api $api) {
60
+        return array_map(function(Api $api) {
61 61
             return [
62 62
                 'method' => $api->getEndpoint()->getMethod(),
63 63
                 'version' => $api->getEndpoint()->getVersion(),
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     private function createParamsList(ApiHandlerInterface $handler): array
81 81
     {
82
-        return array_map(function (InputParam $param) {
82
+        return array_map(function(InputParam $param) {
83 83
             $parameter = [
84 84
                 'type' => $param->getType(),
85 85
                 'key' => $param->getKey(),
Please login to merge, or discard this patch.
src/ApiDecider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
     public function enableGlobalPreflight(ApiHandlerInterface $corsHandler = null)
48 48
     {
49
-        if (!$corsHandler) {
49
+        if ( ! $corsHandler) {
50 50
             $corsHandler = new CorsPreflightHandler(new Response());
51 51
         }
52 52
         $this->globalPreflightHandler = $corsHandler;
Please login to merge, or discard this patch.
src/Component/ApiListingControl.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
         $versionHandlers = [];
41 41
         foreach ($handlers as $handler) {
42 42
             $endPoint = $handler->getEndpoint();
43
-            if (!isset($versionHandlers[$endPoint->getVersion()])) {
43
+            if ( ! isset($versionHandlers[$endPoint->getVersion()])) {
44 44
                 $versionHandlers[$endPoint->getVersion()] = [];
45 45
             }
46 46
             $versionHandlers[$endPoint->getVersion()][] = $handler;
Please login to merge, or discard this patch.
src/Authorization/BearerTokenAuthorization.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
         }
46 46
 
47 47
         $result = $this->tokenRepository->validToken($token);
48
-        if (!$result) {
48
+        if ( ! $result) {
49 49
             $this->errorMessage = 'Token doesn\'t exists or isn\'t active';
50 50
             return false;
51 51
         }
52 52
 
53
-        if (!$this->isValidIp($this->tokenRepository->ipRestrictions($token))) {
53
+        if ( ! $this->isValidIp($this->tokenRepository->ipRestrictions($token))) {
54 54
             $this->errorMessage = 'Invalid IP';
55 55
             return false;
56 56
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         list($range, $netmask) = explode('/', $range, 2);
114 114
         $range_decimal = ip2long($range);
115 115
         $ipDecimal = ip2long($ip);
116
-        $wildcard_decimal = pow(2, (32 - (int)$netmask)) - 1;
116
+        $wildcard_decimal = pow(2, (32 - (int) $netmask)) - 1;
117 117
         $netmask_decimal = ~ $wildcard_decimal;
118 118
         return (($ipDecimal & $netmask_decimal) == ($range_decimal & $netmask_decimal));
119 119
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     private function readAuthorizationToken(): ?string
128 128
     {
129
-        if (!isset($_SERVER['HTTP_AUTHORIZATION'])) {
129
+        if ( ! isset($_SERVER['HTTP_AUTHORIZATION'])) {
130 130
             $this->errorMessage = 'Authorization header HTTP_Authorization is not set';
131 131
             return null;
132 132
         }
Please login to merge, or discard this patch.
src/Presenters/ApiPresenter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
     private function checkAuth(ApiAuthorizationInterface $authorization): bool
116 116
     {
117
-        if (!$authorization->authorized()) {
117
+        if ( ! $authorization->authorized()) {
118 118
             $this->getHttpResponse()->setCode(Response::S403_FORBIDDEN);
119 119
             $this->sendResponse(new JsonResponse(['status' => 'error', 'message' => $authorization->getErrorMessage()]));
120 120
             return false;
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 
190 190
     private function getRequestDomain(): ?string
191 191
     {
192
-        if (!filter_input(INPUT_SERVER, 'HTTP_REFERER')) {
192
+        if ( ! filter_input(INPUT_SERVER, 'HTTP_REFERER')) {
193 193
             return null;
194 194
         }
195 195
         $refererParsedUrl = parse_url(filter_input(INPUT_SERVER, 'HTTP_REFERER'));
196
-        if (!(isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) {
196
+        if ( ! (isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) {
197 197
             return null;
198 198
         }
199 199
         $url = $refererParsedUrl['scheme'] . '://' . $refererParsedUrl['host'];
Please login to merge, or discard this patch.
src/Misc/IpDetector.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@
 block discarded – undo
9 9
      */
10 10
     public function getRequestIp(): string
11 11
     {
12
-        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
12
+        if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
13 13
             $ip = $_SERVER['HTTP_CLIENT_IP'];
14
-        } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '127.0.0.1') {
14
+        } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '127.0.0.1') {
15 15
             $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
16
-        } elseif (!empty($_SERVER['REMOTE_ADDR'])) {
16
+        } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
17 17
             $ip = $_SERVER['REMOTE_ADDR'];
18 18
         } else {
19 19
             $ip = 'cli';
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
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
     public function getValue()
10 10
     {
11
-        if (!filter_has_var(INPUT_GET, $this->key) && isset($_GET[$this->key])) {
11
+        if ( ! filter_has_var(INPUT_GET, $this->key) && isset($_GET[$this->key])) {
12 12
             return $_GET[$this->key];
13 13
         }
14 14
         $value = $this->isMulti() ? filter_input(INPUT_GET, $this->key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY) : filter_input(INPUT_GET, $this->key);
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
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
     public function getValue()
10 10
     {
11
-        if (!filter_has_var(INPUT_POST, $this->key) && isset($_POST[$this->key])) {
11
+        if ( ! filter_has_var(INPUT_POST, $this->key) && isset($_POST[$this->key])) {
12 12
             return $_POST[$this->key];
13 13
         }
14 14
         $value = $this->isMulti() ? filter_input(INPUT_POST, $this->key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY) : filter_input(INPUT_POST, $this->key);
Please login to merge, or discard this patch.