@@ -79,7 +79,7 @@ |
||
79 | 79 | */ |
80 | 80 | private function setUserSecret(string $userId, string $secret): void |
81 | 81 | { |
82 | - $data=array(); |
|
82 | + $data = array(); |
|
83 | 83 | if ($this->_userExists($userId)) { |
84 | 84 | $data = $this->_loadUser($userId); |
85 | 85 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function userExists(string $userId): bool |
84 | 84 | { |
85 | 85 | try { |
86 | - $sth = $this->handle->prepare('SELECT userid FROM ' . $this->tableName . ' WHERE userid = ?'); |
|
86 | + $sth = $this->handle->prepare('SELECT userid FROM '.$this->tableName.' WHERE userid = ?'); |
|
87 | 87 | $sth->execute(array($userId)); |
88 | 88 | return (false !== $sth->fetchColumn()); |
89 | 89 | } |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | private function getUserSecret(string $userId): string |
104 | 104 | { |
105 | 105 | try { |
106 | - $sth = $this->handle->prepare('SELECT secret FROM ' . $this->tableName . ' WHERE userid = ?'); |
|
106 | + $sth = $this->handle->prepare('SELECT secret FROM '.$this->tableName.' WHERE userid = ?'); |
|
107 | 107 | $sth->execute(array($userId)); |
108 | - $res=$sth->fetchColumn(); |
|
108 | + $res = $sth->fetchColumn(); |
|
109 | 109 | if ($res === false) { |
110 | 110 | // No result |
111 | 111 | $this->logger->error(sprintf('No result getting secret for user "%s"', $userId)); |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | // - The INSERT will fail when displayname has a NOT NULL constraint |
142 | 142 | try { |
143 | 143 | if ($this->userExists($userId)) { |
144 | - $sth = $this->handle->prepare('UPDATE ' . $this->tableName . ' SET secret = ? WHERE userid = ?'); |
|
144 | + $sth = $this->handle->prepare('UPDATE '.$this->tableName.' SET secret = ? WHERE userid = ?'); |
|
145 | 145 | } else { |
146 | - $sth = $this->handle->prepare('INSERT INTO ' . $this->tableName . ' (secret,userid) VALUES (?,?)'); |
|
146 | + $sth = $this->handle->prepare('INSERT INTO '.$this->tableName.' (secret,userid) VALUES (?,?)'); |
|
147 | 147 | } |
148 | 148 | $sth->execute(array($secret, $userId)); |
149 | 149 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * @param array $options The options |
60 | 60 | * @param LoggerInterface $logger |
61 | 61 | */ |
62 | - public function __construct(array $options=array(), LoggerInterface $logger) |
|
62 | + public function __construct(array $options = array(), LoggerInterface $logger) |
|
63 | 63 | { |
64 | 64 | $this->_options = $options; |
65 | 65 | $this->logger = $logger; |
@@ -74,7 +74,7 @@ |
||
74 | 74 | */ |
75 | 75 | public function getPath(): string |
76 | 76 | { |
77 | - if (substr($this->path, -1)!="/") return $this->path."/"; |
|
77 | + if (substr($this->path, -1) != "/") return $this->path."/"; |
|
78 | 78 | return $this->path; |
79 | 79 | } |
80 | 80 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * |
41 | 41 | * @return Tiqr_UserSecretStorage_Encryption_Interface |
42 | 42 | */ |
43 | - public static function getEncryption(LoggerInterface $logger, string $type="dummy", array $options=array()): Tiqr_UserSecretStorage_Encryption_Interface |
|
43 | + public static function getEncryption(LoggerInterface $logger, string $type = "dummy", array $options = array()): Tiqr_UserSecretStorage_Encryption_Interface |
|
44 | 44 | { |
45 | 45 | $logger->info(sprintf('Using %s as UserStorage encryption type', $type)); |
46 | 46 | switch ($type) { |
@@ -170,10 +170,10 @@ |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | if ($timestamp + $tempBlockDuration * 60 < time()) { |
173 | - return false; // Temp block expired |
|
173 | + return false; // Temp block expired |
|
174 | 174 | } |
175 | 175 | } |
176 | - return true; // Blocked by temp block |
|
176 | + return true; // Blocked by temp block |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -128,7 +128,7 @@ |
||
128 | 128 | * |
129 | 129 | * Note that the $tempBlockDuration is specified in MINUTES |
130 | 130 | */ |
131 | - public function isBlocked(string $userId, int $tempBlockDuration=0): bool; |
|
131 | + public function isBlocked(string $userId, int $tempBlockDuration = 0): bool; |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Block or unblock the user account. |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @throws ReadWriteException |
30 | 30 | * @throws Exception |
31 | 31 | */ |
32 | - public function setValue(string $key, $value, int $expire=0): void; |
|
32 | + public function setValue(string $key, $value, int $expire = 0): void; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Remove $key from the state storage |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * @see Tiqr_StateStorage_StateStorageInterface::setValue() |
49 | 49 | */ |
50 | - public function setValue(string $key, $value, int $expire=0): void |
|
50 | + public function setValue(string $key, $value, int $expire = 0): void |
|
51 | 51 | { |
52 | 52 | if (empty($key)) { |
53 | 53 | throw new InvalidArgumentException('Empty key not allowed'); |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | |
110 | 110 | private function getPath(): string |
111 | 111 | { |
112 | - if (substr($this->path, -1)!=="/") { |
|
113 | - return $this->path . "/"; |
|
112 | + if (substr($this->path, -1) !== "/") { |
|
113 | + return $this->path."/"; |
|
114 | 114 | } |
115 | 115 | return $this->path; |
116 | 116 | } |