@@ -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; |
@@ -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 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @param mixed $value The data to store in state storage |
24 | 24 | * @param int $expire The expiration (in seconds) of the data |
25 | 25 | */ |
26 | - public function setValue($key, $value, $expire=0); |
|
26 | + public function setValue($key, $value, $expire = 0); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Remove a value from the state storage |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * (non-PHPdoc) |
49 | 49 | * @see library/tiqr/Tiqr/StateStorage/Tiqr_StateStorage_Abstract::setValue() |
50 | 50 | */ |
51 | - public function setValue($key, $value, $expire=0) |
|
51 | + public function setValue($key, $value, $expire = 0) |
|
52 | 52 | { |
53 | 53 | $envelope = array("expire"=>$expire, |
54 | 54 | "createdAt"=>time(), |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | |
100 | 100 | private function getPath(): string |
101 | 101 | { |
102 | - if (substr($this->path, -1)!=="/") { |
|
103 | - return $this->path . "/"; |
|
102 | + if (substr($this->path, -1) !== "/") { |
|
103 | + return $this->path."/"; |
|
104 | 104 | } |
105 | 105 | return $this->path; |
106 | 106 | } |
@@ -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; |