@@ -190,7 +190,7 @@ |
||
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 { |
@@ -53,11 +53,11 @@ discard block |
||
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 |
||
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(), |
@@ -46,7 +46,7 @@ |
||
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; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | protected function getFractal(): Manager |
44 | 44 | { |
45 | - if (!$this->fractal) { |
|
45 | + if ( ! $this->fractal) { |
|
46 | 46 | throw new InvalidStateException("Fractal manager isnt initialized. Did you call parent::__construct() in your handler constructor?"); |
47 | 47 | } |
48 | 48 | return $this->fractal; |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | */ |
85 | 85 | final public function createLink(array $params = []): string |
86 | 86 | { |
87 | - if (!$this->linkGenerator) { |
|
87 | + if ( ! $this->linkGenerator) { |
|
88 | 88 | throw new InvalidStateException("You have setupLinkGenerator for this handler if you want to generate link in this handler"); |
89 | 89 | } |
90 | - if (!$this->endpoint) { |
|
90 | + if ( ! $this->endpoint) { |
|
91 | 91 | throw new InvalidStateException("You have setEndpoint() for this handler if you want to generate link in this handler"); |
92 | 92 | } |
93 | 93 | $params = array_merge([ |
@@ -88,7 +88,7 @@ |
||
88 | 88 | |
89 | 89 | if ($param->getAvailableValues() && is_array($param->getAvailableValues())) { |
90 | 90 | $c = $form->addSelect($key, $this->getParamLabel($param), array_combine($param->getAvailableValues(), $param->getAvailableValues())); |
91 | - if (!$param->isRequired()) { |
|
91 | + if ( ! $param->isRequired()) { |
|
92 | 92 | $c->setPrompt('Select ' . $this->getLabel($param)); |
93 | 93 | } |
94 | 94 | } elseif ($param->getAvailableValues() && is_string($param->getAvailableValues())) { |
@@ -40,7 +40,7 @@ |
||
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; |
@@ -45,12 +45,12 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | const TYPE_FILE = 'FILE'; |
13 | 13 | const TYPE_COOKIE = 'COOKIE'; |
14 | 14 | const TYPE_POST_RAW = 'POST_RAW'; |
15 | - const TYPE_POST_JSON_KEY = 'POST_JSON_KEY'; |
|
15 | + const TYPE_POST_JSON_KEY = 'POST_JSON_KEY'; |
|
16 | 16 | |
17 | 17 | const OPTIONAL = false; |
18 | 18 | const REQUIRED = true; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | public function getValue() |
123 | 123 | { |
124 | 124 | if ($this->type == self::TYPE_GET) { |
125 | - if (!filter_has_var(INPUT_GET, $this->key) && isset($_GET[$this->key])) { |
|
125 | + if ( ! filter_has_var(INPUT_GET, $this->key) && isset($_GET[$this->key])) { |
|
126 | 126 | return $_GET[$this->key]; |
127 | 127 | } |
128 | 128 | if ($this->isMulti()) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | return filter_input(INPUT_GET, $this->key); |
132 | 132 | } |
133 | 133 | if ($this->type == self::TYPE_POST) { |
134 | - if (!filter_has_var(INPUT_POST, $this->key) && isset($_POST[$this->key])) { |
|
134 | + if ( ! filter_has_var(INPUT_POST, $this->key) && isset($_POST[$this->key])) { |
|
135 | 135 | return $_POST[$this->key]; |
136 | 136 | } |
137 | 137 | if ($this->isMulti()) { |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function isError() |
16 | 16 | { |
17 | 17 | foreach ($this->params as $param) { |
18 | - if (!$param->isValid()) { |
|
18 | + if ( ! $param->isValid()) { |
|
19 | 19 | return "Invalid value for {$param->getKey()}"; |
20 | 20 | } |
21 | 21 | } |