Passed
Push — devel-3.0 ( af8b21...5a06ca )
by Rubén
03:22
created

Password::setUseSymbols()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * sysPass
4
 *
5
 * @author    nuxsmin
6
 * @link      https://syspass.org
7
 * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org
8
 *
9
 * This file is part of sysPass.
10
 *
11
 * sysPass is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU General Public License as published by
13
 * the Free Software Foundation, either version 3 of the License, or
14
 * (at your option) any later version.
15
 *
16
 * sysPass is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 *  along with sysPass.  If not, see <http://www.gnu.org/licenses/>.
23
 */
24
25
namespace SP\DataModel\ItemPreset;
26
27
/**
28
 * Class Password
29
 *
30
 * @package SP\DataModel\ItemPreset
31
 */
32
class Password
33
{
34
    const EXPIRE_TIME_MULTIPLIER = 86400;
35
36
    /**
37
     * @var int
38
     */
39
    private $length = 0;
40
    /**
41
     * @var bool
42
     */
43
    private $useNumbers = false;
44
    /**
45
     * @var bool
46
     */
47
    private $useLetters = false;
48
    /**
49
     * @var bool
50
     */
51
    private $useSymbols = false;
52
    /**
53
     * @var bool
54
     */
55
    private $useUpper = false;
56
    /**
57
     * @var bool
58
     */
59
    private $useLower = false;
60
    /**
61
     * @var bool
62
     */
63
    private $useImage = false;
64
    /**
65
     * @var int
66
     */
67
    private $expireTime = 0;
68
    /**
69
     * @var int
70
     */
71
    private $score = 0;
72
    /**
73
     * @var string
74
     */
75
    private $regex;
76
77
    /**
78
     * @return string
79
     */
80
    public function getRegex(): string
81
    {
82
        return $this->regex ?: '';
83
    }
84
85
    /**
86
     * @param string $regex
87
     *
88
     * @return Password
89
     */
90
    public function setRegex(string $regex): Password
91
    {
92
        $this->regex = $regex;
93
        return $this;
94
    }
95
96
    /**
97
     * @return int
98
     */
99
    public function getScore(): int
100
    {
101
        return $this->score;
102
    }
103
104
    /**
105
     * @param int $score
106
     *
107
     * @return Password
108
     */
109
    public function setScore(int $score): Password
110
    {
111
        $this->score = $score;
112
        return $this;
113
    }
114
115
    /**
116
     * @return int
117
     */
118
    public function getLength(): int
119
    {
120
        return $this->length;
121
    }
122
123
    /**
124
     * @param int $length
125
     *
126
     * @return Password
127
     */
128
    public function setLength(int $length): Password
129
    {
130
        $this->length = $length;
131
        return $this;
132
    }
133
134
    /**
135
     * @return bool
136
     */
137
    public function isUseNumbers(): bool
138
    {
139
        return $this->useNumbers;
140
    }
141
142
    /**
143
     * @param bool $useNumbers
144
     *
145
     * @return Password
146
     */
147
    public function setUseNumbers(bool $useNumbers): Password
148
    {
149
        $this->useNumbers = $useNumbers;
150
        return $this;
151
    }
152
153
    /**
154
     * @return bool
155
     */
156
    public function isUseLetters(): bool
157
    {
158
        return $this->useLetters;
159
    }
160
161
    /**
162
     * @param bool $useLetters
163
     *
164
     * @return Password
165
     */
166
    public function setUseLetters(bool $useLetters): Password
167
    {
168
        $this->useLetters = $useLetters;
169
        return $this;
170
    }
171
172
    /**
173
     * @return bool
174
     */
175
    public function isUseSymbols(): bool
176
    {
177
        return $this->useSymbols;
178
    }
179
180
    /**
181
     * @param bool $useSymbols
182
     *
183
     * @return Password
184
     */
185
    public function setUseSymbols(bool $useSymbols): Password
186
    {
187
        $this->useSymbols = $useSymbols;
188
        return $this;
189
    }
190
191
    /**
192
     * @return bool
193
     */
194
    public function isUseUpper(): bool
195
    {
196
        return $this->useUpper;
197
    }
198
199
    /**
200
     * @param bool $useUpper
201
     *
202
     * @return Password
203
     */
204
    public function setUseUpper(bool $useUpper): Password
205
    {
206
        $this->useUpper = $useUpper;
207
        return $this;
208
    }
209
210
    /**
211
     * @return bool
212
     */
213
    public function isUseLower(): bool
214
    {
215
        return $this->useLower;
216
    }
217
218
    /**
219
     * @param bool $useLower
220
     *
221
     * @return Password
222
     */
223
    public function setUseLower(bool $useLower): Password
224
    {
225
        $this->useLower = $useLower;
226
        return $this;
227
    }
228
229
    /**
230
     * @return bool
231
     */
232
    public function isUseImage(): bool
233
    {
234
        return $this->useImage;
235
    }
236
237
    /**
238
     * @param bool $useImage
239
     *
240
     * @return Password
241
     */
242
    public function setUseImage(bool $useImage): Password
243
    {
244
        $this->useImage = $useImage;
245
        return $this;
246
    }
247
248
    /**
249
     * @return int
250
     */
251
    public function getExpireTime(): int
252
    {
253
        return $this->expireTime;
254
    }
255
256
    /**
257
     * @param int $expireTime
258
     *
259
     * @return Password
260
     */
261
    public function setExpireTime(int $expireTime): Password
262
    {
263
        $this->expireTime = $expireTime * self::EXPIRE_TIME_MULTIPLIER;
264
265
        return $this;
266
    }
267
}