Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
14.29% covered (danger)
14.29%
1 / 7
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
CookieStoreSetting
14.29% covered (danger)
14.29%
1 / 7
0.00% covered (danger)
0.00%
0 / 1
8.67
0.00% covered (danger)
0.00%
0 / 1
 __construct
14.29% covered (danger)
14.29%
1 / 7
0.00% covered (danger)
0.00%
0 / 1
8.67
1<?php
2
3declare(strict_types=1);
4
5namespace PeServer\App\Models\Configuration;
6
7use PeServer\Core\Store\CookieOptions;
8
9/**
10 * Cookie設定。
11 *
12 * @immutable
13 */
14class CookieStoreSetting
15{
16    #region variable
17
18    public ?string $span = null; //@phpstan-ignore-line [CODE_READONLY]
19    public ?string $path = null; //@phpstan-ignore-line [CODE_READONLY]
20    public ?bool $secure = null; //@phpstan-ignore-line [CODE_READONLY]
21    public ?bool $httpOnly = null; //@phpstan-ignore-line [CODE_READONLY]
22    /**
23     * @var string|null
24     * @phpstan-var CookieSameSiteAlias|null
25     */
26    public ?string $sameSite = null; //@phpstan-ignore-line [CODE_READONLY]
27
28    #endregion
29
30    public function __construct(?CookieOptions $option = null)
31    {
32        if ($option !== null) {
33            if ($option->span !== null) {
34                $this->span = $option->span->format('P%yY%mM%dDT%hH%iM%sS');
35            }
36            $this->path = $option->path;
37            $this->secure = $option->secure;
38            $this->httpOnly = $option->httpOnly;
39            $this->sameSite = $option->sameSite;
40        }
41    }
42}