@@ -61,14 +61,14 @@ discard block |
||
| 61 | 61 | // Make sure that all required parameters are present. |
| 62 | 62 | foreach (['dsn', 'username', 'password', 'query'] as $param) { |
| 63 | 63 | if (!array_key_exists($param, $config)) { |
| 64 | - throw new Exception('Missing required attribute \'' . $param . |
|
| 65 | - '\' for authentication source ' . $this->authId); |
|
| 64 | + throw new Exception('Missing required attribute \''.$param. |
|
| 65 | + '\' for authentication source '.$this->authId); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | if (!is_string($config[$param])) { |
| 69 | - throw new Exception('Expected parameter \'' . $param . |
|
| 70 | - '\' for authentication source ' . $this->authId . |
|
| 71 | - ' to be a string. Instead it was: ' . |
|
| 69 | + throw new Exception('Expected parameter \''.$param. |
|
| 70 | + '\' for authentication source '.$this->authId. |
|
| 71 | + ' to be a string. Instead it was: '. |
|
| 72 | 72 | var_export($config[$param], true)); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | try { |
| 94 | 94 | $db = new PDO($this->dsn, $this->username, $this->password, $this->options); |
| 95 | 95 | } catch (PDOException $e) { |
| 96 | - throw new \Exception('sqlauth:' . $this->authId . ': - Failed to connect to \'' . |
|
| 97 | - $this->dsn . '\': ' . $e->getMessage()); |
|
| 96 | + throw new \Exception('sqlauth:'.$this->authId.': - Failed to connect to \''. |
|
| 97 | + $this->dsn.'\': '.$e->getMessage()); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
@@ -138,30 +138,30 @@ discard block |
||
| 138 | 138 | try { |
| 139 | 139 | $sth = $db->prepare($this->query); |
| 140 | 140 | } catch (PDOException $e) { |
| 141 | - throw new Exception('sqlauth:' . $this->authId . |
|
| 142 | - ': - Failed to prepare query: ' . $e->getMessage()); |
|
| 141 | + throw new Exception('sqlauth:'.$this->authId. |
|
| 142 | + ': - Failed to prepare query: '.$e->getMessage()); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | try { |
| 146 | 146 | $sth->execute(['username' => $username, 'password' => $password]); |
| 147 | 147 | } catch (PDOException $e) { |
| 148 | - throw new Exception('sqlauth:' . $this->authId . |
|
| 149 | - ': - Failed to execute query: ' . $e->getMessage()); |
|
| 148 | + throw new Exception('sqlauth:'.$this->authId. |
|
| 149 | + ': - Failed to execute query: '.$e->getMessage()); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | try { |
| 153 | 153 | $data = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 154 | 154 | } catch (PDOException $e) { |
| 155 | - throw new Exception('sqlauth:' . $this->authId . |
|
| 156 | - ': - Failed to fetch result set: ' . $e->getMessage()); |
|
| 155 | + throw new Exception('sqlauth:'.$this->authId. |
|
| 156 | + ': - Failed to fetch result set: '.$e->getMessage()); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - Logger::info('sqlauth:' . $this->authId . ': Got ' . count($data) . |
|
| 159 | + Logger::info('sqlauth:'.$this->authId.': Got '.count($data). |
|
| 160 | 160 | ' rows from database'); |
| 161 | 161 | |
| 162 | 162 | if (count($data) === 0) { |
| 163 | 163 | // No rows returned - invalid username/password |
| 164 | - Logger::error('sqlauth:' . $this->authId . |
|
| 164 | + Logger::error('sqlauth:'.$this->authId. |
|
| 165 | 165 | ': No rows in result set. Probably wrong username/password.'); |
| 166 | 166 | throw new Error\Error('WRONGUSERPASS'); |
| 167 | 167 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - Logger::info('sqlauth:' . $this->authId . ': Attributes: ' . implode(',', array_keys($attributes))); |
|
| 195 | + Logger::info('sqlauth:'.$this->authId.': Attributes: '.implode(',', array_keys($attributes))); |
|
| 196 | 196 | |
| 197 | 197 | return $attributes; |
| 198 | 198 | } |