| @@ 45-58 (lines=14) @@ | ||
| 42 | * @param string|int $action Action string to use in Nonce generation |
|
| 43 | * @param ConfigInterface $config |
|
| 44 | */ |
|
| 45 | public function __construct($action = -1, ConfigInterface $config = null) |
|
| 46 | { |
|
| 47 | $this->action = $action; |
|
| 48 | ||
| 49 | if (is_null($config)) { |
|
| 50 | $config = new Config(); |
|
| 51 | } |
|
| 52 | ||
| 53 | $this->lifespan = $config->getLifespan(); |
|
| 54 | $this->algorithm = $config->getAlgorithm(); |
|
| 55 | $this->salt = $config->getSalt(); |
|
| 56 | $this->sessionToken = $config->getSessionToken(); |
|
| 57 | $this->userId = $config->getUserId(); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Return nonce string if object is casted to string |
|
| @@ 40-51 (lines=12) @@ | ||
| 37 | * |
|
| 38 | * @param ConfigInterface $config |
|
| 39 | */ |
|
| 40 | public function __construct(ConfigInterface $config = null) |
|
| 41 | { |
|
| 42 | if (is_null($config)) { |
|
| 43 | $config = new Config(); |
|
| 44 | } |
|
| 45 | ||
| 46 | $this->lifespan = $config->getLifespan(); |
|
| 47 | $this->algorithm = $config->getAlgorithm(); |
|
| 48 | $this->salt = $config->getSalt(); |
|
| 49 | $this->sessionToken = $config->getSessionToken(); |
|
| 50 | $this->userId = $config->getUserId(); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * @param string $nonce |
|