@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param mixed $value The data to store in state storage |
48 | 48 | * @param int $expire The expiration (in seconds) of the data |
49 | 49 | */ |
50 | - public abstract function setValue($key, $value, $expire=0); |
|
50 | + public abstract function setValue($key, $value, $expire = 0); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Remove a value from the state storage |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * a state storage instance of a certain type. |
82 | 82 | * @param array $options An array of options for the state storage |
83 | 83 | */ |
84 | - public function __construct($options=array(), LoggerInterface $logger) |
|
84 | + public function __construct($options = array(), LoggerInterface $logger) |
|
85 | 85 | { |
86 | 86 | $this->logger = $logger; |
87 | 87 | $this->_options = $options; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * |
41 | 41 | * @return Tiqr_UserStorage_Encryption_Interface |
42 | 42 | */ |
43 | - public static function getEncryption(LoggerInterface $logger, $type="dummy", $options=array()) |
|
43 | + public static function getEncryption(LoggerInterface $logger, $type = "dummy", $options = array()) |
|
44 | 44 | { |
45 | 45 | $logger->info(sprintf('Using %s as UserStorage encryption type', $type)); |
46 | 46 | switch ($type) { |
@@ -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 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | public function encrypt($data); |
42 | 42 | |
43 | 43 | /** |
44 | - * Decrypts the given data. |
|
44 | + * Decrypts the given data. |
|
45 | 45 | * |
46 | 46 | * @param String $data Data to decrypt. |
47 | 47 | * |
@@ -57,7 +57,7 @@ |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * Decrypts the given data. |
|
60 | + * Decrypts the given data. |
|
61 | 61 | * |
62 | 62 | * @param String $data Data to decrypt. |
63 | 63 | * |
@@ -57,7 +57,7 @@ |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * Decrypts the given data. |
|
60 | + * Decrypts the given data. |
|
61 | 61 | * |
62 | 62 | * @param String $data Data to decrypt. |
63 | 63 | * |
@@ -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 | } |