@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | ->from(self::TAG_TABLE); |
140 | 140 | |
141 | 141 | if (!\is_null($visibilityFilter)) { |
142 | - $query->andWhere($query->expr()->eq('visibility', $query->createNamedParameter((int)$visibilityFilter))); |
|
142 | + $query->andWhere($query->expr()->eq('visibility', $query->createNamedParameter((int) $visibilityFilter))); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if (!empty($nameSearchPattern)) { |
146 | 146 | $query->andWhere( |
147 | 147 | $query->expr()->like( |
148 | 148 | 'name', |
149 | - $query->createNamedParameter('%' . $this->connection->escapeLikeParameter($nameSearchPattern). '%') |
|
149 | + $query->createNamedParameter('%'.$this->connection->escapeLikeParameter($nameSearchPattern).'%') |
|
150 | 150 | ) |
151 | 151 | ); |
152 | 152 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $result->closeCursor(); |
181 | 181 | if (!$row) { |
182 | 182 | throw new TagNotFoundException( |
183 | - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') does not exist' |
|
183 | + 'Tag ("'.$tagName.'", '.$userVisible.', '.$userAssignable.') does not exist' |
|
184 | 184 | ); |
185 | 185 | } |
186 | 186 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $query->execute(); |
204 | 204 | } catch (UniqueConstraintViolationException $e) { |
205 | 205 | throw new TagAlreadyExistsException( |
206 | - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists', |
|
206 | + 'Tag ("'.$tagName.'", '.$userVisible.', '.$userAssignable.') already exists', |
|
207 | 207 | 0, |
208 | 208 | $e |
209 | 209 | ); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $tagId = $query->getLastInsertId(); |
213 | 213 | |
214 | 214 | $tag = new SystemTag( |
215 | - (string)$tagId, |
|
215 | + (string) $tagId, |
|
216 | 216 | $tagName, |
217 | 217 | $userVisible, |
218 | 218 | $userAssignable |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | } |
265 | 265 | } catch (UniqueConstraintViolationException $e) { |
266 | 266 | throw new TagAlreadyExistsException( |
267 | - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists', |
|
267 | + 'Tag ("'.$tagName.'", '.$userVisible.', '.$userAssignable.') already exists', |
|
268 | 268 | 0, |
269 | 269 | $e |
270 | 270 | ); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | private function createSystemTagFromRow($row) { |
374 | - return new SystemTag((string)$row['id'], $row['name'], (bool)$row['visibility'], (bool)$row['editable']); |
|
374 | + return new SystemTag((string) $row['id'], $row['name'], (bool) $row['visibility'], (bool) $row['editable']); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -233,7 +233,7 @@ |
||
233 | 233 | $result->closeCursor(); |
234 | 234 | |
235 | 235 | if ($all) { |
236 | - return ((int)$row[0] === \count($objIds)); |
|
236 | + return ((int) $row[0] === \count($objIds)); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | return (bool) $row; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function __destruct() { |
70 | 70 | try { |
71 | 71 | $this->close(); |
72 | - } catch (SessionNotAvailableException $e){ |
|
72 | + } catch (SessionNotAvailableException $e) { |
|
73 | 73 | // This exception can occur if session is already closed |
74 | 74 | // So it is safe to ignore it and let the garbage collector to proceed |
75 | 75 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return string|null Either the value or null |
106 | 106 | */ |
107 | 107 | public function get(string $key) { |
108 | - if(isset($this->sessionValues[$key])) { |
|
108 | + if (isset($this->sessionValues[$key])) { |
|
109 | 109 | return $this->sessionValues[$key]; |
110 | 110 | } |
111 | 111 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * Close the session and release the lock, also writes all changed data in batch |
172 | 172 | */ |
173 | 173 | public function close() { |
174 | - if($this->isModified) { |
|
174 | + if ($this->isModified) { |
|
175 | 175 | $encryptedValue = $this->crypto->encrypt(json_encode($this->sessionValues), $this->passphrase); |
176 | 176 | $this->session->set(self::encryptedSessionName, $encryptedValue); |
177 | 177 | $this->isModified = false; |
@@ -170,12 +170,12 @@ |
||
170 | 170 | */ |
171 | 171 | private function invoke(string $functionName, array $parameters = [], bool $silence = false) { |
172 | 172 | try { |
173 | - if($silence) { |
|
173 | + if ($silence) { |
|
174 | 174 | return @call_user_func_array($functionName, $parameters); |
175 | 175 | } else { |
176 | 176 | return call_user_func_array($functionName, $parameters); |
177 | 177 | } |
178 | - } catch(\Error $e) { |
|
178 | + } catch (\Error $e) { |
|
179 | 179 | $this->trapError($e->getCode(), $e->getMessage()); |
180 | 180 | } |
181 | 181 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return bool |
82 | 82 | */ |
83 | 83 | public function verify(array $data): bool { |
84 | - if(isset($data['message']) |
|
84 | + if (isset($data['message']) |
|
85 | 85 | && isset($data['signature']) |
86 | 86 | && isset($data['message']['signer']) |
87 | 87 | ) { |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $userId = substr($data['message']['signer'], 0, $location); |
90 | 90 | |
91 | 91 | $user = $this->userManager->get($userId); |
92 | - if($user !== null) { |
|
92 | + if ($user !== null) { |
|
93 | 93 | $key = $this->keyManager->getKey($user); |
94 | - return (bool)openssl_verify( |
|
94 | + return (bool) openssl_verify( |
|
95 | 95 | json_encode($data['message']), |
96 | 96 | base64_decode($data['signature']), |
97 | 97 | $key->getPublic(), |
@@ -76,7 +76,7 @@ |
||
76 | 76 | $maxCharIndex = \strlen($characters) - 1; |
77 | 77 | $randomString = ''; |
78 | 78 | |
79 | - while($length > 0) { |
|
79 | + while ($length > 0) { |
|
80 | 80 | $randomNumber = \random_int(0, $maxCharIndex); |
81 | 81 | $randomString .= $characters[$randomNumber]; |
82 | 82 | $length--; |
@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | public function getToken(): string { |
59 | 59 | $token = $this->session->get('requesttoken'); |
60 | - if(empty($token)) { |
|
60 | + if (empty($token)) { |
|
61 | 61 | throw new \Exception('Session does not contain a requesttoken'); |
62 | 62 | } |
63 | 63 |
@@ -52,9 +52,9 @@ |
||
52 | 52 | * @return string |
53 | 53 | */ |
54 | 54 | public function getEncryptedValue(): string { |
55 | - if($this->encryptedValue === '') { |
|
55 | + if ($this->encryptedValue === '') { |
|
56 | 56 | $sharedSecret = random_bytes(\strlen($this->value)); |
57 | - $this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret); |
|
57 | + $this->encryptedValue = base64_encode($this->value ^ $sharedSecret).':'.base64_encode($sharedSecret); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $this->encryptedValue; |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | * @return CsrfToken |
55 | 55 | */ |
56 | 56 | public function getToken(): CsrfToken { |
57 | - if(!\is_null($this->csrfToken)) { |
|
57 | + if (!\is_null($this->csrfToken)) { |
|
58 | 58 | return $this->csrfToken; |
59 | 59 | } |
60 | 60 | |
61 | - if($this->sessionStorage->hasToken()) { |
|
61 | + if ($this->sessionStorage->hasToken()) { |
|
62 | 62 | $value = $this->sessionStorage->getToken(); |
63 | 63 | } else { |
64 | 64 | $value = $this->tokenGenerator->generateToken(); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return bool |
97 | 97 | */ |
98 | 98 | public function isTokenValid(CsrfToken $token): bool { |
99 | - if(!$this->sessionStorage->hasToken()) { |
|
99 | + if (!$this->sessionStorage->hasToken()) { |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 |