@@ -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 | } |
@@ -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; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @throws Tiqr_Message_Exception_SendFailure |
| 59 | 59 | */ |
| 60 | - private function _sendFirebase($deviceToken, $alert, $challenge, $apiKey, $retry=false) |
|
| 60 | + private function _sendFirebase($deviceToken, $alert, $challenge, $apiKey, $retry = false) |
|
| 61 | 61 | { |
| 62 | 62 | $msg = array( |
| 63 | 63 | 'challenge' => $challenge, |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | $headers = array( |
| 74 | - 'Authorization: key=' . $apiKey, |
|
| 74 | + 'Authorization: key='.$apiKey, |
|
| 75 | 75 | 'Content-Type: application/json', |
| 76 | 76 | ); |
| 77 | 77 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $result = curl_exec($ch); |
| 85 | 85 | $errors = curl_error($ch); |
| 86 | 86 | $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
| 87 | - $remoteip = curl_getinfo($ch,CURLINFO_PRIMARY_IP); |
|
| 87 | + $remoteip = curl_getinfo($ch, CURLINFO_PRIMARY_IP); |
|
| 88 | 88 | curl_close($ch); |
| 89 | 89 | |
| 90 | 90 | if ($result === false) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | if (!empty($errors)) { |
| 95 | - throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ". $errors, true); |
|
| 95 | + throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ".$errors, true); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // Wait and retry once in case of a 502 Bad Gateway error |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $response = json_decode($result, true); |
| 111 | 111 | foreach ($response['results'] as $k => $v) { |
| 112 | 112 | if (isset($v['error'])) { |
| 113 | - throw new Tiqr_Message_Exception_SendFailure("Error in FCM response: " . $v['error'], true); |
|
| 113 | + throw new Tiqr_Message_Exception_SendFailure("Error in FCM response: ".$v['error'], true); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -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 | } |