Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Session | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray\Config; |
| 6 | |
| 7 | use SessionHandlerInterface; |
| 8 | |
| 9 | /** @psalm-import-type SessionOptions from Types */ |
| 10 | final class Session |
| 11 | { |
| 12 | /** @var SessionOptions|null */ |
| 13 | private ?array $optionsCache = null; |
| 14 | |
| 15 | public function __construct( |
| 16 | private readonly \Cosray\Config $config, |
| 17 | ) {} |
| 18 | |
| 19 | public bool $enabled { |
| 20 | get => $this->config->get('session.enabled'); |
| 21 | } |
| 22 | |
| 23 | /** @var SessionOptions */ |
| 24 | public array $options { |
| 25 | get => $this->optionsCache ??= $this->config->get('session.options'); |
| 26 | } |
| 27 | |
| 28 | public ?SessionHandlerInterface $handler { |
| 29 | get => $this->config->get('session.handler'); |
| 30 | } |
| 31 | } |