@@ -44,7 +44,7 @@ |
||
| 44 | 44 | * |
| 45 | 45 | * @throws Exception |
| 46 | 46 | */ |
| 47 | - public static function getStorage($type="file", $options=array(), $secretoptions=array(), LoggerInterface $logger) |
|
| 47 | + public static function getStorage($type = "file", $options = array(), $secretoptions = array(), LoggerInterface $logger) |
|
| 48 | 48 | { |
| 49 | 49 | switch ($type) { |
| 50 | 50 | case "file": |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * |
| 39 | 39 | * @return Tiqr_OcraService_Interface |
| 40 | 40 | */ |
| 41 | - public static function getOcraService($type="tiqr", $options=array(), LoggerInterface $logger) |
|
| 41 | + public static function getOcraService($type = "tiqr", $options = array(), LoggerInterface $logger) |
|
| 42 | 42 | { |
| 43 | 43 | switch ($type) { |
| 44 | 44 | case "tiqr": |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | if ($data === NULL) { |
| 33 | 33 | if ($failIfNotFound) { |
| 34 | - throw new Exception('Error loading data for user: ' . var_export($userId, TRUE)); |
|
| 34 | + throw new Exception('Error loading data for user: '.var_export($userId, TRUE)); |
|
| 35 | 35 | } else { |
| 36 | 36 | $this->logger->error('Error loading data for user from user storage (file storage)'); |
| 37 | 37 | return false; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function getPath() |
| 49 | 49 | { |
| 50 | - if (substr($this->path, -1)!="/") return $this->path."/"; |
|
| 50 | + if (substr($this->path, -1) != "/") return $this->path."/"; |
|
| 51 | 51 | return $this->path; |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -47,7 +47,9 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public function getPath() |
| 49 | 49 | { |
| 50 | - if (substr($this->path, -1)!="/") return $this->path."/"; |
|
| 50 | + if (substr($this->path, -1)!="/") { |
|
| 51 | + return $this->path."/"; |
|
| 52 | + } |
|
| 51 | 53 | return $this->path; |
| 52 | 54 | } |
| 53 | 55 | } |
@@ -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 @@ discard block |
||
| 45 | 45 | * options per type. |
| 46 | 46 | * @throws Exception If an unknown type is requested. |
| 47 | 47 | */ |
| 48 | - public static function getStorage($type="file", $options=array(), LoggerInterface $logger) |
|
| 48 | + public static function getStorage($type = "file", $options = array(), LoggerInterface $logger) |
|
| 49 | 49 | { |
| 50 | 50 | switch ($type) { |
| 51 | 51 | case "file": |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $pdoInstance = new PDO($options['dsn'],$options['username'],$options['password']); |
|
| 76 | + $pdoInstance = new PDO($options['dsn'], $options['username'], $options['password']); |
|
| 77 | 77 | // Set a hard-coded default for the probability the expired state is removed |
| 78 | 78 | // 0.1 translates to a 10% chance the garbage collection is executed |
| 79 | 79 | $cleanupProbability = 0.1; |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | * config options per type. |
| 45 | 45 | * @throws Exception An exception if an unknown storage is requested. |
| 46 | 46 | */ |
| 47 | - public static function getStorage($type="dummy", $options=array(), LoggerInterface $logger) |
|
| 47 | + public static function getStorage($type = "dummy", $options = array(), LoggerInterface $logger) |
|
| 48 | 48 | { |
| 49 | 49 | switch ($type) { |
| 50 | 50 | case "dummy": |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | private function getUserSecret($userId) |
| 84 | 84 | { |
| 85 | 85 | $sth = $this->handle->prepare("SELECT secret FROM ".$this->tableName." WHERE userid = ?"); |
| 86 | - if($sth->execute(array($userId))) { |
|
| 86 | + if ($sth->execute(array($userId))) { |
|
| 87 | 87 | return $sth->fetchColumn(); |
| 88 | 88 | } |
| 89 | 89 | $this->logger->error('Unable to retrieve user secret from user secret storage (PDO)'); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } else { |
| 103 | 103 | $sth = $this->handle->prepare("INSERT INTO ".$this->tableName." (secret,userid) VALUES (?,?)"); |
| 104 | 104 | } |
| 105 | - if (!$sth->execute(array($secret,$userId))) { |
|
| 105 | + if (!$sth->execute(array($secret, $userId))) { |
|
| 106 | 106 | $this->logger->error('Unable to persist user secret in user secret storage (PDO)'); |
| 107 | 107 | } |
| 108 | 108 | } |