| Total Complexity | 5 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | final class CsrfConfig extends InjectableConfig |
||
| 18 | { |
||
| 19 | public const CONFIG = 'csrf'; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var array |
||
| 23 | */ |
||
| 24 | protected $config = [ |
||
| 25 | 'cookie' => 'csrf-token', |
||
| 26 | 'length' => 16, |
||
| 27 | 'lifetime' => 86400 |
||
| 28 | ]; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return int |
||
| 32 | */ |
||
| 33 | public function getTokenLength(): int |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return string |
||
| 40 | */ |
||
| 41 | public function getCookie(): string |
||
| 42 | { |
||
| 43 | return $this->config['cookie']; |
||
| 44 | } |
||
| 45 | |||
| 46 | |||
| 47 | /** |
||
| 48 | * @return int|null |
||
| 49 | */ |
||
| 50 | public function getCookieLifetime(): ?int |
||
| 51 | { |
||
| 52 | return $this->config['lifetime'] ?? null; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return bool |
||
| 57 | */ |
||
| 58 | public function isCookieSecure(): bool |
||
| 59 | { |
||
| 60 | return !empty($this->config['secure']); |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return string|null |
||
| 65 | */ |
||
| 66 | public function getSameSite(): ?string |
||
| 69 | } |
||
| 70 | } |
||
| 71 |