Passed
Push — master ( d0848f...c51354 )
by Ross
27:06
created

TwoFactorSecret   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 2
cbo 2
dl 0
loc 39
ccs 11
cts 11
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getValue() 0 4 1
A hasValue() 0 4 1
A setValue() 0 4 1
1
<?php
2
/**
3
 * A two factor authentication module that protects both the admin and customer logins
4
 * Copyright (C) 2017  Ross Mitchell
5
 *
6
 * This file is part of Rossmitchell/Twofactor.
7
 *
8
 * Rossmitchell/Twofactor is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
namespace Rossmitchell\Twofactor\Model\Customer\Attribute;
23
24
class TwoFactorSecret
25
{
26
    const ATTRIBUTE_CODE = 'two_factor_secret';
27
    /**
28
     * @var Getter
29
     */
30
    private $getter;
31
    /**
32
     * @var Setter
33
     */
34
    private $setter;
35
36
    /**
37
     * TwoFactorSecret constructor.
38
     *
39
     * @param Getter $getter
40
     * @param Setter $setter
41
     */
42 7
    public function __construct(Getter $getter, Setter $setter)
43
    {
44 7
        $this->getter = $getter;
45 7
        $this->setter = $setter;
46 7
    }
47
48 8
    public function getValue($customer)
49
    {
50 8
        return $this->getter->getValue($customer, self::ATTRIBUTE_CODE);
51
    }
52
53 3
    public function setValue($customer, $value)
54
    {
55 3
        $this->setter->setValue($customer, self::ATTRIBUTE_CODE, $value);
56 3
    }
57
58 4
    public function hasValue($customer)
59
    {
60 4
        return $this->getter->hasValue($customer, self::ATTRIBUTE_CODE);
61
    }
62
}
63