@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if (isset($this->cache[$tokenHash])) { |
100 | 100 | if ($this->cache[$tokenHash] instanceof DoesNotExistException) { |
101 | 101 | $ex = $this->cache[$tokenHash]; |
102 | - throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex); |
|
102 | + throw new InvalidTokenException("Token does not exist: ".$ex->getMessage(), 0, $ex); |
|
103 | 103 | } |
104 | 104 | $token = $this->cache[$tokenHash]; |
105 | 105 | } else { |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | $this->cache[$token->getToken()] = $token; |
109 | 109 | } catch (DoesNotExistException $ex) { |
110 | 110 | $this->cache[$tokenHash] = $ex; |
111 | - throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex); |
|
111 | + throw new InvalidTokenException("Token does not exist: ".$ex->getMessage(), 0, $ex); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
115 | + if ((int) $token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
116 | 116 | throw new ExpiredTokenException($token); |
117 | 117 | } |
118 | 118 | |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | try { |
133 | 133 | $token = $this->mapper->getTokenById($tokenId); |
134 | 134 | } catch (DoesNotExistException $ex) { |
135 | - throw new InvalidTokenException("Token with ID $tokenId does not exist: " . $ex->getMessage(), 0, $ex); |
|
135 | + throw new InvalidTokenException("Token with ID $tokenId does not exist: ".$ex->getMessage(), 0, $ex); |
|
136 | 136 | } |
137 | 137 | |
138 | - if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
138 | + if ((int) $token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
139 | 139 | throw new ExpiredTokenException($token); |
140 | 140 | } |
141 | 141 | |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | $this->cache->clear(); |
198 | 198 | |
199 | 199 | $olderThan = $this->time->getTime() - (int) $this->config->getSystemValue('session_lifetime', 60 * 60 * 24); |
200 | - $this->logger->debug('Invalidating session tokens older than ' . date('c', $olderThan), ['app' => 'cron']); |
|
200 | + $this->logger->debug('Invalidating session tokens older than '.date('c', $olderThan), ['app' => 'cron']); |
|
201 | 201 | $this->mapper->invalidateOld($olderThan, IToken::DO_NOT_REMEMBER); |
202 | 202 | $rememberThreshold = $this->time->getTime() - (int) $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15); |
203 | - $this->logger->debug('Invalidating remembered session tokens older than ' . date('c', $rememberThreshold), ['app' => 'cron']); |
|
203 | + $this->logger->debug('Invalidating remembered session tokens older than '.date('c', $rememberThreshold), ['app' => 'cron']); |
|
204 | 204 | $this->mapper->invalidateOld($rememberThreshold, IToken::REMEMBER); |
205 | 205 | } |
206 | 206 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | |
291 | 291 | private function encrypt(string $plaintext, string $token): string { |
292 | 292 | $secret = $this->config->getSystemValue('secret'); |
293 | - return $this->crypto->encrypt($plaintext, $token . $secret); |
|
293 | + return $this->crypto->encrypt($plaintext, $token.$secret); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -299,11 +299,11 @@ discard block |
||
299 | 299 | private function decrypt(string $cipherText, string $token): string { |
300 | 300 | $secret = $this->config->getSystemValue('secret'); |
301 | 301 | try { |
302 | - return $this->crypto->decrypt($cipherText, $token . $secret); |
|
302 | + return $this->crypto->decrypt($cipherText, $token.$secret); |
|
303 | 303 | } catch (\Exception $ex) { |
304 | 304 | // Delete the invalid token |
305 | 305 | $this->invalidateToken($token); |
306 | - throw new InvalidTokenException("Could not decrypt token password: " . $ex->getMessage(), 0, $ex); |
|
306 | + throw new InvalidTokenException("Could not decrypt token password: ".$ex->getMessage(), 0, $ex); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | |
324 | 324 | private function hashToken(string $token): string { |
325 | 325 | $secret = $this->config->getSystemValue('secret'); |
326 | - return hash('sha512', $token . $secret); |
|
326 | + return hash('sha512', $token.$secret); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -413,6 +413,6 @@ discard block |
||
413 | 413 | while ($error = openssl_error_string()) { |
414 | 414 | $errors[] = $error; |
415 | 415 | } |
416 | - $this->logger->critical('Something is wrong with your openssl setup: ' . implode(', ', $errors)); |
|
416 | + $this->logger->critical('Something is wrong with your openssl setup: '.implode(', ', $errors)); |
|
417 | 417 | } |
418 | 418 | } |