1
|
|
|
<?php namespace Limoncello\Application\Packages\Session; |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2015-2017 [email protected] |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
use Limoncello\Contracts\Settings\SettingsInterface; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @package Limoncello\Application |
23
|
|
|
*/ |
24
|
|
|
class SessionSettings implements SettingsInterface |
25
|
|
|
{ |
26
|
|
|
/** Settings key */ |
27
|
|
|
const KEY_SAVE_PATH = 'save_path'; |
28
|
|
|
|
29
|
|
|
/** Settings key */ |
30
|
|
|
const KEY_NAME = 'name'; |
31
|
|
|
|
32
|
|
|
/** Settings key */ |
33
|
|
|
const KEY_SAVE_HANDLER = 'save_handler'; |
34
|
|
|
|
35
|
|
|
/** Settings key */ |
36
|
|
|
const KEY_COOKIE_LIFETIME = 'cookie_lifetime'; |
37
|
|
|
|
38
|
|
|
/** Settings key */ |
39
|
|
|
const KEY_COOKIE_PATH = 'cookie_path'; |
40
|
|
|
|
41
|
|
|
/** Settings key */ |
42
|
|
|
const KEY_COOKIE_DOMAIN = 'cookie_domain'; |
43
|
|
|
|
44
|
|
|
/** Settings key */ |
45
|
|
|
const KEY_COOKIE_SECURE = 'cookie_secure'; |
46
|
|
|
|
47
|
|
|
/** Settings key */ |
48
|
|
|
const KEY_COOKIE_HTTP_ONLY = 'cookie_httponly'; |
49
|
|
|
|
50
|
|
|
/** Settings key */ |
51
|
|
|
const KEY_USE_STRICT_MODE = 'use_strict_mode'; |
52
|
|
|
|
53
|
|
|
/** Settings key */ |
54
|
|
|
const KEY_USE_COOKIES = 'use_cookies'; |
55
|
|
|
|
56
|
|
|
/** Settings key */ |
57
|
|
|
const KEY_USE_ONLY_COOKIES = 'use_only_cookies'; |
58
|
|
|
|
59
|
|
|
/** Settings key */ |
60
|
|
|
const KEY_CACHE_LIMITER = 'cache_limiter'; |
61
|
|
|
|
62
|
|
|
/** Settings key */ |
63
|
|
|
const KEY_CACHE_EXPIRE = 'cache_expire'; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @inheritdoc |
67
|
|
|
*/ |
68
|
|
|
final public function get(): array |
69
|
|
|
{ |
70
|
|
|
$defaults = $this->getSettings(); |
71
|
|
|
|
72
|
|
|
return $defaults; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return array |
77
|
|
|
*/ |
78
|
|
|
protected function getSettings(): array |
79
|
|
|
{ |
80
|
|
|
return [ |
81
|
|
|
static::KEY_NAME => 'session_id', |
82
|
|
|
static::KEY_USE_STRICT_MODE => '1', |
83
|
|
|
static::KEY_COOKIE_HTTP_ONLY => '1', |
84
|
|
|
]; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|