@@ -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": |
@@ -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; |
@@ -51,8 +51,8 @@ |
||
| 51 | 51 | public function setValue($key, $value, $expire=0) |
| 52 | 52 | { |
| 53 | 53 | $envelope = array("expire"=>$expire, |
| 54 | - "createdAt"=>time(), |
|
| 55 | - "value"=>$value); |
|
| 54 | + "createdAt"=>time(), |
|
| 55 | + "value"=>$value); |
|
| 56 | 56 | $filename = $this->getFilenameByKey($key); |
| 57 | 57 | |
| 58 | 58 | if (!file_put_contents($filename, serialize($envelope))) { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $this->path = $path; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function setValue($key, $value, $expire=0) |
|
| 47 | + public function setValue($key, $value, $expire = 0) |
|
| 48 | 48 | { |
| 49 | 49 | $envelope = array("expire"=>$expire, |
| 50 | 50 | "createdAt"=>time(), |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | private function getPath(): string |
| 100 | 100 | { |
| 101 | - if (substr($this->path, -1)!=="/") { |
|
| 102 | - return $this->path . "/"; |
|
| 101 | + if (substr($this->path, -1) !== "/") { |
|
| 102 | + return $this->path."/"; |
|
| 103 | 103 | } |
| 104 | 104 | return $this->path; |
| 105 | 105 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | * a state storage instance of a certain type. |
| 61 | 61 | * @param array $options An array of options for the state storage |
| 62 | 62 | */ |
| 63 | - public function __construct($options=array(), LoggerInterface $logger) |
|
| 63 | + public function __construct($options = array(), LoggerInterface $logger) |
|
| 64 | 64 | { |
| 65 | 65 | $this->logger = $logger; |
| 66 | 66 | $this->_options = $options; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | private function getUserSecret($userId) |
| 83 | 83 | { |
| 84 | 84 | $sth = $this->handle->prepare("SELECT secret FROM ".$this->tableName." WHERE userid = ?"); |
| 85 | - if($sth->execute(array($userId))) { |
|
| 85 | + if ($sth->execute(array($userId))) { |
|
| 86 | 86 | $secret = $sth->fetchColumn(); |
| 87 | 87 | if ($secret !== false) { |
| 88 | 88 | return $secret; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } else { |
| 105 | 105 | $sth = $this->handle->prepare("INSERT INTO ".$this->tableName." (secret,userid) VALUES (?,?)"); |
| 106 | 106 | } |
| 107 | - $result = $sth->execute(array($secret,$userId)); |
|
| 107 | + $result = $sth->execute(array($secret, $userId)); |
|
| 108 | 108 | if (!$result) { |
| 109 | 109 | throw new ReadWriteException('Unable to persist user secret in user secret storage (PDO)'); |
| 110 | 110 | } |
@@ -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 | throw new ReadWriteException('The user could not be saved in the user storage (PDO)'); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | public function setNotificationType($userId, $type) |
| 107 | 107 | { |
| 108 | 108 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET notificationtype = ? WHERE userid = ?"); |
| 109 | - if (!$sth->execute(array($type,$userId))) { |
|
| 109 | + if (!$sth->execute(array($type, $userId))) { |
|
| 110 | 110 | throw new ReadWriteException('Unable to set the notification type in user storage for a given user (PDO)'); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | public function setNotificationAddress($userId, $address) |
| 124 | 124 | { |
| 125 | 125 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET notificationaddress = ? WHERE userid = ?"); |
| 126 | - if (!$sth->execute(array($address,$userId))) { |
|
| 126 | + if (!$sth->execute(array($address, $userId))) { |
|
| 127 | 127 | throw new ReadWriteException('Unable to set the notification address in user storage for a given user (PDO)'); |
| 128 | 128 | |
| 129 | 129 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | public function setLoginAttempts($userId, $amount) |
| 142 | 142 | { |
| 143 | 143 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET loginattempts = ? WHERE userid = ?"); |
| 144 | - if (!$sth->execute(array($amount,$userId))) { |
|
| 144 | + if (!$sth->execute(array($amount, $userId))) { |
|
| 145 | 145 | throw new ReadWriteException('Unable to set login attempts in user storage for a given user (PDO)'); |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | public function setTemporaryBlockAttempts($userId, $amount) { |
| 176 | 176 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET tmpblockattempts = ? WHERE userid = ?"); |
| 177 | - if (!$sth->execute(array($amount,$userId))) { |
|
| 177 | + if (!$sth->execute(array($amount, $userId))) { |
|
| 178 | 178 | throw new ReadWriteException('Unable to set temp login attempts in user storage for a given user (PDO)'); |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | public function setTemporaryBlockTimestamp($userId, $timestamp) |
| 200 | 200 | { |
| 201 | 201 | $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET tmpblocktimestamp = ? WHERE userid = ?"); |
| 202 | - if (!$sth->execute(array($timestamp,$userId))) { |
|
| 202 | + if (!$sth->execute(array($timestamp, $userId))) { |
|
| 203 | 203 | throw new ReadWriteException('Unable to update temp lock timestamp in user storage for a given user (PDO)'); |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * @param int $expire The expiration (in seconds) of the data |
| 25 | 25 | * @throws ReadWriteException |
| 26 | 26 | */ |
| 27 | - public function setValue($key, $value, $expire=0); |
|
| 27 | + public function setValue($key, $value, $expire = 0); |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Remove a value from the state storage |