@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function userExists(string $userId): bool |
88 | 88 | { |
89 | 89 | try { |
90 | - $sth = $this->handle->prepare('SELECT userid FROM ' . $this->tableName . ' WHERE userid = ?'); |
|
90 | + $sth = $this->handle->prepare('SELECT userid FROM '.$this->tableName.' WHERE userid = ?'); |
|
91 | 91 | $sth->execute(array($userId)); |
92 | 92 | return (false !== $sth->fetchColumn()); |
93 | 93 | } |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | protected function getUserSecret(string $userId): string |
108 | 108 | { |
109 | 109 | try { |
110 | - $sth = $this->handle->prepare('SELECT secret FROM ' . $this->tableName . ' WHERE userid = ?'); |
|
110 | + $sth = $this->handle->prepare('SELECT secret FROM '.$this->tableName.' WHERE userid = ?'); |
|
111 | 111 | $sth->execute(array($userId)); |
112 | - $res=$sth->fetchColumn(); |
|
112 | + $res = $sth->fetchColumn(); |
|
113 | 113 | if ($res === false) { |
114 | 114 | // No result |
115 | 115 | $this->logger->error(sprintf('No result getting secret for user "%s"', $userId)); |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | // - The INSERT will fail when displayname has a NOT NULL constraint |
146 | 146 | try { |
147 | 147 | if ($this->userExists($userId)) { |
148 | - $sth = $this->handle->prepare('UPDATE ' . $this->tableName . ' SET secret = ? WHERE userid = ?'); |
|
148 | + $sth = $this->handle->prepare('UPDATE '.$this->tableName.' SET secret = ? WHERE userid = ?'); |
|
149 | 149 | } else { |
150 | - $sth = $this->handle->prepare('INSERT INTO ' . $this->tableName . ' (secret,userid) VALUES (?,?)'); |
|
150 | + $sth = $this->handle->prepare('INSERT INTO '.$this->tableName.' (secret,userid) VALUES (?,?)'); |
|
151 | 151 | } |
152 | 152 | $sth->execute(array($secret, $userId)); |
153 | 153 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $sth->execute(); |
172 | 172 | } |
173 | 173 | catch (Exception $e) { |
174 | - $statusMessage = "UserSecretStorage_PDO error: " . $e->getMessage(); |
|
174 | + $statusMessage = "UserSecretStorage_PDO error: ".$e->getMessage(); |
|
175 | 175 | return false; |
176 | 176 | } |
177 | 177 |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | if ($prefix === $this->encryption->get_type()) { |
58 | 58 | // Decrypt the secret if it is prefixed with the current encryption type |
59 | 59 | // Remove the encryption type prefix before decrypting |
60 | - return $this->encryption->decrypt( substr($encryptedSecret, $pos+1) ); |
|
60 | + return $this->encryption->decrypt(substr($encryptedSecret, $pos + 1)); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Check the decryption array for the encryption type to see if there is an encryption |
64 | 64 | // instance defined for it. If so, use that to decrypt the secret. |
65 | 65 | if (isset($this->decryption[$prefix])) { |
66 | - return $this->decryption[$prefix]->decrypt( substr($encryptedSecret, $pos+1) ); |
|
66 | + return $this->decryption[$prefix]->decrypt(substr($encryptedSecret, $pos + 1)); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $this->logger->error("Secret for user '$userId' is encrypted with unsupported encryption type '$prefix'"); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | $encryptedSecret = $this->encryption->encrypt($secret); |
82 | 82 | // Prefix the user secret with the encryption type |
83 | - $this->setUserSecret($userId, $this->encryption->get_type() . ':' . $encryptedSecret); |
|
83 | + $this->setUserSecret($userId, $this->encryption->get_type().':'.$encryptedSecret); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -88,6 +88,6 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function healthCheck(string &$statusMessage = ''): bool |
90 | 90 | { |
91 | - return true; // Health check is always successful when not implemented |
|
91 | + return true; // Health check is always successful when not implemented |
|
92 | 92 | } |
93 | 93 | } |