Lines 100.00% 6 / 6
Methods 100.00% 4 / 4
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 set 100.00% 1 / 1 100.00% 1 / 1 1
 getAndDelete 100.00% 3 / 3 100.00% 1 / 1 1
 delete 100.00% 1 / 1 100.00% 1 / 1 1
9final readonly class Session
10{
11    /**
12     * @param Helper<mixed> $helper
13     */
14    public function __construct(
15        private Helper $helper,
16    ) {
17    }
18
19    public function set(string $key, mixed $value): void
20    {
21        $this->helper->set($key, $value);
22    }
23
24    public function getAndDelete(string $key, mixed $default = null): mixed
25    {
26        $value = $this->helper->get($key, $default);
27        $this->helper->delete($key);
28        return $value;
29    }
30
31    public function delete(string $key): void
32    {
33        $this->helper->delete($key);
34    }
35}