@@ -143,25 +143,33 @@ |
||
| 143 | 143 | |
| 144 | 144 | private function _base32Decode($secret) |
| 145 | 145 | { |
| 146 | - if (empty($secret)) return ''; |
|
| 146 | + if (empty($secret)) { |
|
| 147 | + return ''; |
|
| 148 | + } |
|
| 147 | 149 | |
| 148 | 150 | $base32chars = $this->_getBase32LookupTable(); |
| 149 | 151 | $base32charsFlipped = array_flip($base32chars); |
| 150 | 152 | |
| 151 | 153 | $paddingCharCount = substr_count($secret, $base32chars[32]); |
| 152 | 154 | $allowedValues = array(6, 4, 3, 1, 0); |
| 153 | - if (!in_array($paddingCharCount, $allowedValues)) return false; |
|
| 155 | + if (!in_array($paddingCharCount, $allowedValues)) { |
|
| 156 | + return false; |
|
| 157 | + } |
|
| 154 | 158 | for ($i = 0; $i < 4; $i++) { |
| 155 | 159 | if ($paddingCharCount == $allowedValues[$i] && |
| 156 | 160 | substr($secret, -($allowedValues[$i])) != str_repeat($base32chars[32], $allowedValues[$i]) |
| 157 | - ) return false; |
|
| 161 | + ) { |
|
| 162 | + return false; |
|
| 163 | + } |
|
| 158 | 164 | } |
| 159 | 165 | $secret = str_replace('=', '', $secret); |
| 160 | 166 | $secret = str_split($secret); |
| 161 | 167 | $binaryString = ""; |
| 162 | 168 | for ($i = 0; $i < count($secret); $i = $i + 8) { |
| 163 | 169 | $x = ""; |
| 164 | - if (!in_array($secret[$i], $base32chars)) return false; |
|
| 170 | + if (!in_array($secret[$i], $base32chars)) { |
|
| 171 | + return false; |
|
| 172 | + } |
|
| 165 | 173 | for ($j = 0; $j < 8; $j++) { |
| 166 | 174 | $x .= str_pad(base_convert(@$base32charsFlipped[@$secret[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT); |
| 167 | 175 | } |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | - * @param $object |
|
| 121 | - * @param $method |
|
| 120 | + * @param string $object |
|
| 121 | + * @param string $method |
|
| 122 | 122 | * @param array $params |
| 123 | 123 | * @return mixed |
| 124 | 124 | */ |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | 190 | * @param $secret |
| 191 | - * @return bool|string |
|
| 191 | + * @return string|false |
|
| 192 | 192 | */ |
| 193 | 193 | private function _base32Decode($secret) |
| 194 | 194 | { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
| 226 | - * @return array |
|
| 226 | + * @return string[] |
|
| 227 | 227 | */ |
| 228 | 228 | private function _getBase32LookupTable() |
| 229 | 229 | { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | - * @param $language |
|
| 268 | + * @param string $language |
|
| 269 | 269 | */ |
| 270 | 270 | public function setLanguage($language) |
| 271 | 271 | { |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | - * @return null|string |
|
| 292 | + * @return string |
|
| 293 | 293 | */ |
| 294 | 294 | public function getCookiefile() |
| 295 | 295 | { |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | - * @return null |
|
| 328 | + * @return string |
|
| 329 | 329 | */ |
| 330 | 330 | public function getClTrId() |
| 331 | 331 | { |