@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | parent::__construct($config, $logger); |
| 47 | 47 | $this->tablename = isset($config['table']) ? $config['table'] : 'tiqruser'; |
| 48 | 48 | try { |
| 49 | - $this->handle = new PDO($config['dsn'],$config['username'],$config['password']); |
|
| 49 | + $this->handle = new PDO($config['dsn'], $config['username'], $config['password']); |
|
| 50 | 50 | } catch (PDOException $e) { |
| 51 | 51 | $this->logger->error( |
| 52 | 52 | sprintf('Unable to establish a PDO connection. Error message from PDO: %s', $e->getMessage()) |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } else { |
| 62 | 62 | $sth = $this->handle->prepare("INSERT INTO ".$this->tablename." (displayname,userid) VALUES (?,?)"); |
| 63 | 63 | } |
| 64 | - if ($sth->execute(array($displayName,$userId))){ |
|
| 64 | + if ($sth->execute(array($displayName, $userId))) { |
|
| 65 | 65 | return $this->userExists($userId); |
| 66 | 66 | } |
| 67 | 67 | $this->logger->error('The user could not be saved in the user storage (PDO)'); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | public function setNotificationType($userId, $type) |
| 106 | 106 | { |
| 107 | 107 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET notificationtype = ? WHERE userid = ?"); |
| 108 | - if (!$sth->execute(array($type,$userId))) { |
|
| 108 | + if (!$sth->execute(array($type, $userId))) { |
|
| 109 | 109 | $this->logger->error('Unable to set the notification type in user storage for a given user (PDO)'); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | public function setNotificationAddress($userId, $address) |
| 123 | 123 | { |
| 124 | 124 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET notificationaddress = ? WHERE userid = ?"); |
| 125 | - if (!$sth->execute(array($address,$userId))) { |
|
| 125 | + if (!$sth->execute(array($address, $userId))) { |
|
| 126 | 126 | $this->logger->error('Unable to set the notification address in user storage for a given user (PDO)'); |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | public function setLoginAttempts($userId, $amount) |
| 140 | 140 | { |
| 141 | 141 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET loginattempts = ? WHERE userid = ?"); |
| 142 | - if (!$sth->execute(array($amount,$userId))) { |
|
| 142 | + if (!$sth->execute(array($amount, $userId))) { |
|
| 143 | 143 | $this->logger->error('Unable to set login attempts in user storage for a given user (PDO)'); |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | public function setTemporaryBlockAttempts($userId, $amount) { |
| 174 | 174 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET tmpblockattempts = ? WHERE userid = ?"); |
| 175 | - if (!$sth->execute(array($amount,$userId))) { |
|
| 175 | + if (!$sth->execute(array($amount, $userId))) { |
|
| 176 | 176 | $this->logger->error('Unable to set temp login attempts in user storage for a given user (PDO)'); |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | public function setTemporaryBlockTimestamp($userId, $timestamp) |
| 198 | 198 | { |
| 199 | 199 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET tmpblocktimestamp = ? WHERE userid = ?"); |
| 200 | - if (!$sth->execute(array($timestamp,$userId))) { |
|
| 200 | + if (!$sth->execute(array($timestamp, $userId))) { |
|
| 201 | 201 | $this->logger->error('Unable to update temp lock timestamp in user storage for a given user (PDO)'); |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | * @param LoggerInterface $logger |
| 46 | 46 | * @throws Exception An exception if an unknown storage is requested. |
| 47 | 47 | */ |
| 48 | - public static function getStorage($type="dummy", $options=array(), LoggerInterface $logger) |
|
| 48 | + public static function getStorage($type = "dummy", $options = array(), LoggerInterface $logger) |
|
| 49 | 49 | { |
| 50 | 50 | switch ($type) { |
| 51 | 51 | case "dummy": |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | private function getUserSecret($userId) |
| 89 | 89 | { |
| 90 | 90 | $sth = $this->handle->prepare("SELECT secret FROM ".$this->tableName." WHERE userid = ?"); |
| 91 | - if($sth->execute(array($userId))) { |
|
| 91 | + if ($sth->execute(array($userId))) { |
|
| 92 | 92 | $secret = $sth->fetchColumn(); |
| 93 | 93 | if ($secret !== false) { |
| 94 | 94 | return $secret; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | } else { |
| 111 | 111 | $sth = $this->handle->prepare("INSERT INTO ".$this->tableName." (secret,userid) VALUES (?,?)"); |
| 112 | 112 | } |
| 113 | - $result = $sth->execute(array($secret,$userId)); |
|
| 113 | + $result = $sth->execute(array($secret, $userId)); |
|
| 114 | 114 | if (!$result) { |
| 115 | 115 | $this->logger->error('Unable to persist user secret in user secret storage (PDO)'); |
| 116 | 116 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | * |
| 42 | 42 | * @throws Exception An exception if an unknown user storage is requested. |
| 43 | 43 | */ |
| 44 | - public static function getStorage($type="file", $options=array(), LoggerInterface $logger) |
|
| 44 | + public static function getStorage($type = "file", $options = array(), LoggerInterface $logger) |
|
| 45 | 45 | { |
| 46 | 46 | switch ($type) { |
| 47 | 47 | case "file": |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | * @return Tiqr_OcraService_Interface |
| 40 | 40 | * @throws Exception An exception if an unknown orca service type is requested. |
| 41 | 41 | */ |
| 42 | - public static function getOcraService($type="tiqr", $options=array(), LoggerInterface $logger) |
|
| 42 | + public static function getOcraService($type = "tiqr", $options = array(), LoggerInterface $logger) |
|
| 43 | 43 | { |
| 44 | 44 | switch ($type) { |
| 45 | 45 | case "tiqr": |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @throws RuntimeException When the options configuration array misses a required parameter |
| 48 | 48 | * |
| 49 | 49 | */ |
| 50 | - public static function getStorage($type="file", $options=array(), LoggerInterface $logger) |
|
| 50 | + public static function getStorage($type = "file", $options = array(), LoggerInterface $logger) |
|
| 51 | 51 | { |
| 52 | 52 | switch ($type) { |
| 53 | 53 | case "file": |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $pdoInstance = new PDO($options['dsn'],$options['username'],$options['password']); |
|
| 78 | + $pdoInstance = new PDO($options['dsn'], $options['username'], $options['password']); |
|
| 79 | 79 | // Set a hard-coded default for the probability the expired state is removed |
| 80 | 80 | // 0.1 translates to a 10% chance the garbage collection is executed |
| 81 | 81 | $cleanupProbability = 0.1; |