Passed
Push — develop ( 1e050e...a909ab )
by Pieter van der
01:06 queued 12s
created
library/tiqr/Tiqr/UserSecretStorage/File.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
      */
80 80
     private function setUserSecret(string $userId, string $secret): void
81 81
     {
82
-        $data=array();
82
+        $data = array();
83 83
         if ($this->_userExists($userId)) {
84 84
             $data = $this->_loadUser($userId);
85 85
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserSecretStorage/Pdo.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     public function userExists(string $userId): bool
84 84
     {
85 85
         try {
86
-            $sth = $this->handle->prepare('SELECT userid FROM ' . $this->tableName . ' WHERE userid = ?');
86
+            $sth = $this->handle->prepare('SELECT userid FROM '.$this->tableName.' WHERE userid = ?');
87 87
             $sth->execute(array($userId));
88 88
             return (false !== $sth->fetchColumn());
89 89
         }
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
     private function getUserSecret(string $userId): string
104 104
     {
105 105
         try {
106
-            $sth = $this->handle->prepare('SELECT secret FROM ' . $this->tableName . ' WHERE userid = ?');
106
+            $sth = $this->handle->prepare('SELECT secret FROM '.$this->tableName.' WHERE userid = ?');
107 107
             $sth->execute(array($userId));
108
-            $res=$sth->fetchColumn();
108
+            $res = $sth->fetchColumn();
109 109
             if ($res === false) {
110 110
                 // No result
111 111
                 $this->logger->error(sprintf('No result getting secret for user "%s"', $userId));
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
         // - The INSERT will fail when displayname has a NOT NULL constraint
142 142
         try {
143 143
             if ($this->userExists($userId)) {
144
-                $sth = $this->handle->prepare('UPDATE ' . $this->tableName . ' SET secret = ? WHERE userid = ?');
144
+                $sth = $this->handle->prepare('UPDATE '.$this->tableName.' SET secret = ? WHERE userid = ?');
145 145
             } else {
146
-                $sth = $this->handle->prepare('INSERT INTO ' . $this->tableName . ' (secret,userid) VALUES (?,?)');
146
+                $sth = $this->handle->prepare('INSERT INTO '.$this->tableName.' (secret,userid) VALUES (?,?)');
147 147
             }
148 148
             $sth->execute(array($secret, $userId));
149 149
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Exception/ReadWriteException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,6 +21,6 @@
 block discarded – undo
21 21
     public static function fromOriginalException(Exception $e): ReadWriteException
22 22
     {
23 23
         // $code must be int, otherwise this throws with Error("Wrong parameters for ReadWriteException")
24
-        return new self($e->getMessage(), (int)$e->getCode(), $e );
24
+        return new self($e->getMessage(), (int) $e->getCode(), $e);
25 25
     }
26 26
 }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/DeviceStorage/Abstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
      * @param array $options The options
60 60
      * @param LoggerInterface $logger
61 61
      */
62
-    public function __construct(array $options=array(), LoggerInterface $logger)
62
+    public function __construct(array $options = array(), LoggerInterface $logger)
63 63
     {
64 64
         $this->_options = $options;
65 65
         $this->logger = $logger;
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/FileTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
      */
75 75
     public function getPath(): string
76 76
     {
77
-        if (substr($this->path, -1)!="/") return $this->path."/";
77
+        if (substr($this->path, -1) != "/") return $this->path."/";
78 78
         return $this->path;
79 79
     }
80 80
 }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/Encryption.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
      *
41 41
      * @return Tiqr_UserSecretStorage_Encryption_Interface
42 42
      */
43
-    public static function getEncryption(LoggerInterface $logger, string $type="dummy", array $options=array()): Tiqr_UserSecretStorage_Encryption_Interface
43
+    public static function getEncryption(LoggerInterface $logger, string $type = "dummy", array $options = array()): Tiqr_UserSecretStorage_Encryption_Interface
44 44
     {
45 45
         $logger->info(sprintf('Using %s as UserStorage encryption type', $type));
46 46
         switch ($type) {
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/GenericStore.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,10 +170,10 @@
 block discarded – undo
170 170
             }
171 171
 
172 172
             if ($timestamp + $tempBlockDuration * 60 < time()) {
173
-                return false;   // Temp block expired
173
+                return false; // Temp block expired
174 174
             }
175 175
         }
176
-        return true;    // Blocked by temp block
176
+        return true; // Blocked by temp block
177 177
     }
178 178
     
179 179
     /**
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/Interface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
      *
129 129
      * Note that the $tempBlockDuration is specified in MINUTES
130 130
      */
131
-    public function isBlocked(string $userId, int $tempBlockDuration=0): bool;
131
+    public function isBlocked(string $userId, int $tempBlockDuration = 0): bool;
132 132
     
133 133
     /**
134 134
      * Block or unblock the user account.
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/Pdo.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -82,21 +82,21 @@  discard block
 block discarded – undo
82 82
      */
83 83
     private function _getStringValue(string $columnName, string $userId): string
84 84
     {
85
-        if ( !in_array($columnName, $this->_allowedStringColumns) ) {
85
+        if (!in_array($columnName, $this->_allowedStringColumns)) {
86 86
             throw new InvalidArgumentException('Unsupported column name');
87 87
         }
88 88
 
89 89
         try {
90
-            $sth = $this->handle->prepare('SELECT ' . $columnName . ' FROM ' . $this->tablename . ' WHERE userid = ?');
90
+            $sth = $this->handle->prepare('SELECT '.$columnName.' FROM '.$this->tablename.' WHERE userid = ?');
91 91
             $sth->execute(array($userId));
92
-            $res=$sth->fetchColumn();
92
+            $res = $sth->fetchColumn();
93 93
             if ($res === false) {
94 94
                 // No result
95 95
                 $this->logger->error(sprintf('No result getting "%s" for user "%s"', $columnName, $userId));
96 96
                 throw new RuntimeException('User not found');
97 97
             }
98 98
             if ($res === NULL) {
99
-                return '';  // Value unset
99
+                return ''; // Value unset
100 100
             }
101 101
             if (!is_string($res)) {
102 102
                 $this->logger->error(sprintf('Expected string type while getting "%s" for user "%s"', $columnName, $userId));
@@ -120,28 +120,28 @@  discard block
 block discarded – undo
120 120
      */
121 121
     private function _getIntValue(string $columnName, string $userId): int
122 122
     {
123
-        if ( !in_array($columnName, $this->_allowedIntColumns) ) {
123
+        if (!in_array($columnName, $this->_allowedIntColumns)) {
124 124
             throw new InvalidArgumentException('Unsupported column name');
125 125
         }
126 126
 
127 127
         try {
128
-            $sth = $this->handle->prepare('SELECT ' . $columnName . ' FROM ' . $this->tablename . ' WHERE userid = ?');
128
+            $sth = $this->handle->prepare('SELECT '.$columnName.' FROM '.$this->tablename.' WHERE userid = ?');
129 129
             $sth->execute(array($userId));
130
-            $res=$sth->fetchColumn();
130
+            $res = $sth->fetchColumn();
131 131
             if ($res === false) {
132 132
                 // No result
133 133
                 $this->logger->error(sprintf('No result getting "%s" for user "%s"', $columnName, $userId));
134 134
                 throw new RuntimeException('User not found');
135 135
             }
136 136
             if ($res === NULL) {
137
-                return 0;  // Value unset
137
+                return 0; // Value unset
138 138
             }
139 139
             // Return type for integers depends on the PDO driver, can be string
140 140
             if (!is_numeric($res)) {
141 141
                 $this->logger->error(sprintf('Expected int type while getting "%s" for user "%s"', $columnName, $userId));
142 142
                 throw new RuntimeException('Unexpected return type');
143 143
             }
144
-            return (int)$res;
144
+            return (int) $res;
145 145
         }
146 146
         catch (Exception $e) {
147 147
             $this->logger->error('PDO error getting user', array('exception' => $e, 'userId' => $userId, 'columnName'=>$columnName));
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
      */
159 159
     private function _setStringValue(string $columnName, string $userId, string $value): void
160 160
     {
161
-        if ( !in_array($columnName, $this->_allowedStringColumns) ) {
161
+        if (!in_array($columnName, $this->_allowedStringColumns)) {
162 162
             throw new InvalidArgumentException('Unsupported column name');
163 163
         }
164 164
         try {
165
-            $sth = $this->handle->prepare('UPDATE ' . $this->tablename . ' SET ' . $columnName . ' = ? WHERE userid = ?');
165
+            $sth = $this->handle->prepare('UPDATE '.$this->tablename.' SET '.$columnName.' = ? WHERE userid = ?');
166 166
             $sth->execute(array($value, $userId));
167 167
             if ($sth->rowCount() == 0) {
168 168
                 throw new RuntimeException('User not found');
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
      */
184 184
     private function _setIntValue(string $columnName, string $userId, int $value): void
185 185
     {
186
-        if ( !in_array($columnName, $this->_allowedIntColumns) ) {
186
+        if (!in_array($columnName, $this->_allowedIntColumns)) {
187 187
             throw new InvalidArgumentException('Unsupported column name');
188 188
         }
189 189
         try {
190
-            $sth = $this->handle->prepare('UPDATE ' . $this->tablename . ' SET ' . $columnName . ' = ? WHERE userid = ?');
190
+            $sth = $this->handle->prepare('UPDATE '.$this->tablename.' SET '.$columnName.' = ? WHERE userid = ?');
191 191
             $sth->execute(array($value, $userId));
192 192
             if ($sth->rowCount() == 0) {
193 193
                 throw new RuntimeException('User not found');
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
     {
297 297
         // Check for blocked
298 298
         if ($this->_getIntValue('blocked', $userId) != 0) {
299
-            return true;   // Blocked
299
+            return true; // Blocked
300 300
         }
301 301
 
302 302
         if (0 == $tempBlockDuration) {
303
-            return false;   // No check for temporary block
303
+            return false; // No check for temporary block
304 304
         }
305 305
 
306 306
         // Check for temporary block
307 307
         $timestamp = $this->getTemporaryBlockTimestamp($userId);
308 308
         // if no temporary block timestamp is set or if the temporary block is expired, return false
309
-        if ( 0 == $timestamp || ($timestamp + $tempBlockDuration * 60) < time()) {
309
+        if (0 == $timestamp || ($timestamp + $tempBlockDuration * 60) < time()) {
310 310
             return false;
311 311
         }
312 312
         return true;
Please login to merge, or discard this patch.