@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * The default configuration |
| 52 | 52 | */ |
| 53 | 53 | const DEFAULT_HOST = '127.0.0.1'; |
| 54 | - const DEFAULT_PORT = 11211; |
|
| 54 | + const DEFAULT_PORT = 11211; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Get the prefix to use for all keys in memcache. |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | /** |
| 104 | 104 | * @see Tiqr_StateStorage_StateStorageInterface::setValue() |
| 105 | 105 | */ |
| 106 | - public function setValue(string $key, $value, int $expire=0): void |
|
| 106 | + public function setValue(string $key, $value, int $expire = 0): void |
|
| 107 | 107 | { |
| 108 | 108 | if (empty($key)) { |
| 109 | 109 | throw new InvalidArgumentException('Empty key not allowed'); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | if ($result === false) { |
| 158 | 158 | // Memcache interface does not provide error information, either the key does not exists or |
| 159 | 159 | // there was an error communicating with the memcache |
| 160 | - $this->logger->info( sprintf('Unable to get key "%s" from memcache StateStorage', $key) ); |
|
| 160 | + $this->logger->info(sprintf('Unable to get key "%s" from memcache StateStorage', $key)); |
|
| 161 | 161 | return null; |
| 162 | 162 | } |
| 163 | 163 | return $result; |
@@ -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(string $type="tiqr", array $options=array(), LoggerInterface $logger) |
|
| 42 | + public static function getOcraService(string $type = "tiqr", array $options = array(), LoggerInterface $logger) |
|
| 43 | 43 | { |
| 44 | 44 | switch ($type) { |
| 45 | 45 | case "tiqr": |
@@ -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(string $type="file", array $options=array(), LoggerInterface $logger): Tiqr_UserStorage_Interface |
|
| 44 | + public static function getStorage(string $type = "file", array $options = array(), LoggerInterface $logger): Tiqr_UserStorage_Interface |
|
| 45 | 45 | { |
| 46 | 46 | switch ($type) { |
| 47 | 47 | case "file": |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | 'verifyResponse for user "%s" failed', |
| 82 | 82 | $userId |
| 83 | 83 | ), |
| 84 | - array( 'exception' => $e) |
|
| 84 | + array('exception' => $e) |
|
| 85 | 85 | ); |
| 86 | 86 | return false; |
| 87 | 87 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | use Psr\Log\LoggerInterface; |
| 21 | 21 | |
| 22 | -require_once(__DIR__ . '/../OATH/OCRAParser.php'); |
|
| 22 | +require_once(__DIR__.'/../OATH/OCRAParser.php'); |
|
| 23 | 23 | |
| 24 | 24 | abstract class Tiqr_OcraService_Abstract implements Tiqr_OcraService_Interface |
| 25 | 25 | { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $this->logger = $logger; |
| 38 | 38 | |
| 39 | 39 | // Set the OCRA suite |
| 40 | - $this->_ocraSuite = $config['ocra.suite'] ?? 'OCRA-1:HOTP-SHA1-6:QH10-S'; // Use tiqr server default suite |
|
| 40 | + $this->_ocraSuite = $config['ocra.suite'] ?? 'OCRA-1:HOTP-SHA1-6:QH10-S'; // Use tiqr server default suite |
|
| 41 | 41 | $this->_ocraParser = new OATH_OCRAParser($this->_ocraSuite); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | public static function randomBytes(int $length): string |
| 43 | 43 | { |
| 44 | 44 | // Get $length cryptographically secure pseudo-random bytes |
| 45 | - $rnd=\random_bytes($length); |
|
| 45 | + $rnd = \random_bytes($length); |
|
| 46 | 46 | |
| 47 | 47 | if (strlen($rnd) !== $length) { |
| 48 | 48 | throw new Exception("random_bytes did not return the requested number of bytes"); |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | * @throws RuntimeException When the options configuration array misses a required parameter |
| 48 | 48 | * |
| 49 | 49 | */ |
| 50 | - public static function getStorage(string $type="file", array $options=array(), LoggerInterface $logger) |
|
| 50 | + public static function getStorage(string $type = "file", array $options = array(), LoggerInterface $logger) |
|
| 51 | 51 | { |
| 52 | 52 | switch ($type) { |
| 53 | 53 | case "file": |
@@ -22,6 +22,6 @@ |
||
| 22 | 22 | { |
| 23 | 23 | // $code must be int, otherwise this throws with Error("Wrong parameters for ReadWriteException") |
| 24 | 24 | // PDOException::getCode() can return a sting |
| 25 | - return new self($e->getMessage(), (int)$e->getCode(), $e ); |
|
| 25 | + return new self($e->getMessage(), (int) $e->getCode(), $e); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once __DIR__ . '/../OATH/OCRA.php'; |
|
| 3 | +require_once __DIR__.'/../OATH/OCRA.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * This file is part of the tiqr project. |