@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | private function getCutoff(int $expire): \DateInterval { |
| 94 | 94 | $d1 = new \DateTime(); |
| 95 | 95 | $d2 = clone $d1; |
| 96 | - $d2->sub(new \DateInterval('PT' . $expire . 'S')); |
|
| 96 | + $d2->sub(new \DateInterval('PT'.$expire.'S')); |
|
| 97 | 97 | return $d2->diff($d1); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $values = [ |
| 130 | 130 | 'action' => $action, |
| 131 | 131 | 'occurred' => $this->timeFactory->getTime(), |
| 132 | - 'ip' => (string)$ipAddress, |
|
| 132 | + 'ip' => (string) $ipAddress, |
|
| 133 | 133 | 'subnet' => $ipAddress->getSubnet(), |
| 134 | 134 | 'metadata' => json_encode($metadata), |
| 135 | 135 | ]; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $keys = $this->config->getAppKeys('bruteForce'); |
| 168 | - $keys = array_filter($keys, function ($key) { |
|
| 168 | + $keys = array_filter($keys, function($key) { |
|
| 169 | 169 | return 0 === strpos($key, 'whitelist_'); |
| 170 | 170 | }); |
| 171 | 171 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $cx = explode('/', $cidr); |
| 186 | 186 | $addr = $cx[0]; |
| 187 | - $mask = (int)$cx[1]; |
|
| 187 | + $mask = (int) $cx[1]; |
|
| 188 | 188 | |
| 189 | 189 | // Do not compare ipv4 to ipv6 |
| 190 | 190 | if (($type === 4 && !filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) || |
@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $valid = true; |
| 198 | 198 | for ($i = 0; $i < $mask; $i++) { |
| 199 | - $part = ord($addr[(int)($i/8)]); |
|
| 200 | - $orig = ord($ip[(int)($i/8)]); |
|
| 199 | + $part = ord($addr[(int) ($i / 8)]); |
|
| 200 | + $orig = ord($ip[(int) ($i / 8)]); |
|
| 201 | 201 | |
| 202 | 202 | $bitmask = 1 << (7 - ($i % 8)); |
| 203 | 203 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $ipAddress = new IpAddress($ip); |
| 235 | - if ($this->isIPWhitelisted((string)$ipAddress)) { |
|
| 235 | + if ($this->isIPWhitelisted((string) $ipAddress)) { |
|
| 236 | 236 | return 0; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | */ |
| 291 | 291 | public function resetDelay(string $ip, string $action, array $metadata): void { |
| 292 | 292 | $ipAddress = new IpAddress($ip); |
| 293 | - if ($this->isIPWhitelisted((string)$ipAddress)) { |
|
| 293 | + if ($this->isIPWhitelisted((string) $ipAddress)) { |
|
| 294 | 294 | return; |
| 295 | 295 | } |
| 296 | 296 | |