ModuleOptions   A
last analyzed

Complexity

Total Complexity 18

Size/Duplication

Total Lines 210
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 18
lcom 0
cbo 1
dl 0
loc 210
ccs 45
cts 45
cp 1
rs 10
c 0
b 0
f 0

18 Methods

Rating   Name   Duplication   Size   Complexity  
A getSerieTokenEntityClass() 0 4 1
A setSerieTokenEntityClass() 0 5 1
A isTokenRefreshedAfterLogin() 0 4 1
A setTokenRefreshedAfterLogin() 0 4 1
A getCookiePath() 0 4 1
A setCookiePath() 0 4 1
A getCookieDomain() 0 4 1
A setCookieDomain() 0 4 1
A getCookieSecure() 0 4 1
A setCookieSecure() 0 4 1
A getCookieHttpOnly() 0 4 1
A setCookieHttpOnly() 0 4 1
A getCookieMaxAge() 0 4 1
A setCookieMaxAge() 0 4 1
A getCookieVersion() 0 4 1
A setCookieVersion() 0 4 1
A getCookieSameSite() 0 4 1
A setCookieSameSite() 0 4 1
1
<?php
2
3
namespace JwPersistentUser\Model;
4
5
use Zend\Stdlib\AbstractOptions;
6
7
class ModuleOptions extends AbstractOptions
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $serieTokenEntityClass = 'JwPersistentUser\Model\SerieToken';
13
14
    /**
15
     * When enabled we will refresh the token each time it is used.
16
     *
17
     * If somebody were to hijack a session of an active user; this would eventually lead to this token being revoked.
18
     *
19
     * However: the big downside to this approach is that a token will also be revoked if a user did not receive
20
     * the (cookie's in the) response from the server. For example because the page loaded slow and he or she closed
21
     * the tab.
22
     *
23
     * @var bool
24
     */
25
    protected $tokenRefreshedAfterLogin = true;
26
27
    /**
28
     * @var string|null
29
     */
30
    protected $cookiePath = '/';
31
32
    /**
33
     * @var string|null
34
     */
35
    protected $cookieDomain = null;
36
37
    /**
38
     * @var bool|null
39
     */
40
    protected $cookieSecure = null;
41
42
    /**
43
     * @var bool|null
44
     */
45
    protected $cookieHttpOnly = null;
46
47
    /**
48
     * @var int|null
49
     */
50
    protected $cookieMaxAge = null;
51
52
    /**
53
     * @var int|null
54
     */
55
    protected $cookieVersion = null;
56
57
    /**
58
     * A valid SameSite option: `none`, `lax` or `strict`.
59
     *
60
     * @var string|null
61
     */
62
    protected $cookieSameSite = null;
63
64
    /**
65
     * @return string
66
     */
67 3
    public function getSerieTokenEntityClass()
68
    {
69 3
        return $this->serieTokenEntityClass;
70
    }
71
72
    /**
73
     * @param string $serieTokenEntityClass
74
     * @return $this
75
     */
76 15
    public function setSerieTokenEntityClass($serieTokenEntityClass)
77
    {
78 15
        $this->serieTokenEntityClass = $serieTokenEntityClass;
79 15
        return $this;
80
    }
81
82
    /**
83
     * @return bool
84
     */
85 2
    public function isTokenRefreshedAfterLogin()
86
    {
87 2
        return $this->tokenRefreshedAfterLogin;
88
    }
89
90
    /**
91
     * @param bool $tokenRefreshedAfterLogin
92
     */
93 1
    public function setTokenRefreshedAfterLogin($tokenRefreshedAfterLogin)
94
    {
95 1
        $this->tokenRefreshedAfterLogin = $tokenRefreshedAfterLogin;
96 1
    }
97
98
    /**
99
     * @return string|null
100
     */
101 2
    public function getCookiePath()
102
    {
103 2
        return $this->cookiePath;
104
    }
105
106
    /**
107
     * @param $cookiePath
108
     * @return void
109
     */
110 1
    public function setCookiePath($cookiePath)
111
    {
112 1
        $this->cookiePath = $cookiePath;
113 1
    }
114
115
    /**
116
     * @return string|null
117
     */
118 2
    public function getCookieDomain()
119
    {
120 2
        return $this->cookieDomain;
121
    }
122
123
    /**
124
     * @param $cookieDomain
125
     * @return void
126
     */
127 1
    public function setCookieDomain($cookieDomain)
128
    {
129 1
        $this->cookieDomain = $cookieDomain;
130 1
    }
131
132
    /**
133
     * @return bool|null
134
     */
135 2
    public function getCookieSecure()
136
    {
137 2
        return $this->cookieSecure;
138
    }
139
140
    /**
141
     * @param $cookieSecure
142
     * @return void
143
     */
144 1
    public function setCookieSecure($cookieSecure)
145
    {
146 1
        $this->cookieSecure = $cookieSecure;
147 1
    }
148
149
    /**
150
     * @return bool|null
151
     */
152 2
    public function getCookieHttpOnly()
153
    {
154 2
        return $this->cookieHttpOnly;
155
    }
156
157
    /**
158
     * @param $cookieHttpOnly
159
     * @return void
160
     */
161 1
    public function setCookieHttpOnly($cookieHttpOnly)
162
    {
163 1
        $this->cookieHttpOnly = $cookieHttpOnly;
164 1
    }
165
166
    /**
167
     * @return int|null
168
     */
169 2
    public function getCookieMaxAge()
170
    {
171 2
        return $this->cookieMaxAge;
172
    }
173
174
    /**
175
     * @param $cookieMaxAge
176
     * @return void
177
     */
178 1
    public function setCookieMaxAge($cookieMaxAge)
179
    {
180 1
        $this->cookieMaxAge = $cookieMaxAge;
181 1
    }
182
183
    /**
184
     * @return int|null
185
     */
186 2
    public function getCookieVersion()
187
    {
188 2
        return $this->cookieVersion;
189
    }
190
191
    /**
192
     * @param $cookieVersion
193
     * @return void
194
     */
195 1
    public function setCookieVersion($cookieVersion)
196
    {
197 1
        $this->cookieVersion = $cookieVersion;
198 1
    }
199
200
    /**
201
     * @return string|null
202
     */
203 2
    public function getCookieSameSite()
204
    {
205 2
        return $this->cookieSameSite;
206
    }
207
208
    /**
209
     * @param $cookieSameSite
210
     * @return void
211
     */
212 1
    public function setCookieSameSite($cookieSameSite)
213
    {
214 1
        $this->cookieSameSite = $cookieSameSite;
215 1
    }
216
}
217