Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
12.50% |
1 / 8 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
StoreOptions | |
12.50% |
1 / 8 |
|
50.00% |
1 / 2 |
4.68 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
default | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\Core\Store; |
6 | |
7 | use PeServer\Core\IO\Directory; |
8 | use PeServer\Core\IO\IOUtility; |
9 | use PeServer\Core\IO\Path; |
10 | use PeServer\Core\Store\CookieOptions; |
11 | use PeServer\Core\Store\SessionOptions; |
12 | use PeServer\Core\Store\TemporaryOptions; |
13 | |
14 | /** |
15 | * ストア設定。 |
16 | */ |
17 | readonly class StoreOptions |
18 | { |
19 | public function __construct( |
20 | public CookieOptions $cookie, |
21 | public TemporaryOptions $temporary, |
22 | public SessionOptions $session |
23 | ) { |
24 | } |
25 | |
26 | #region function |
27 | |
28 | public static function default(): self |
29 | { |
30 | $tempDirPath = Directory::getTemporaryDirectory(); |
31 | $cookieOption = new CookieOptions('', null, true, true, 'Lax'); |
32 | |
33 | return new self( |
34 | $cookieOption, |
35 | new TemporaryOptions(TemporaryOptions::DEFAULT_NAME, Path::combine($tempDirPath, TemporaryOptions::DEFAULT_NAME), $cookieOption), |
36 | new SessionOptions(SessionOptions::DEFAULT_NAME, Path::combine($tempDirPath, SessionOptions::DEFAULT_NAME), $cookieOption) |
37 | ); |
38 | } |
39 | |
40 | #endregion |
41 | } |