Development

- Better php7 support.
- Added easier way to debug router.
- Improvements and bugfixes.
- Updated documentation.
This commit is contained in:
Simon Sessingø
2018-03-26 23:43:27 +02:00
parent f23d569757
commit 085f98cf08
28 changed files with 847 additions and 233 deletions
@@ -45,9 +45,9 @@ class CookieTokenProvider implements ITokenProvider
* @param string $token
* @return bool
*/
public function validate($token): bool
public function validate(string $token): bool
{
if ($token !== null && $this->getToken() !== null) {
if ($this->getToken() !== null) {
return hash_equals($token, $this->getToken());
}
@@ -60,7 +60,7 @@ class CookieTokenProvider implements ITokenProvider
*
* @param string $token
*/
public function setToken($token): void
public function setToken(string $token): void
{
$this->token = $token;
setcookie(static::CSRF_KEY, $token, time() + 60 * $this->cookieTimeoutMinutes, '/');
@@ -71,7 +71,7 @@ class CookieTokenProvider implements ITokenProvider
* @param string|null $defaultValue
* @return string|null
*/
public function getToken($defaultValue = null): ?string
public function getToken(?string $defaultValue = null): ?string
{
$this->token = ($this->hasToken() === true) ? $_COOKIE[static::CSRF_KEY] : null;
@@ -108,9 +108,9 @@ class CookieTokenProvider implements ITokenProvider
/**
* Set cookie timeout in minutes
* @param $minutes
* @param int $minutes
*/
public function setCookieTimeoutMinutes($minutes): void
public function setCookieTimeoutMinutes(int $minutes): void
{
$this->cookieTimeoutMinutes = $minutes;
}