Passed
Push — master ( c51354...8b2af1 )
by Ross
30:39
created

Customer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 30
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isTwoFactorEnabled() 0 4 1
A getCompanyName() 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\Config;
23
24
use Magento\Framework\App\Config\ScopeConfigInterface;
25
use Magento\Store\Model\ScopeInterface;
26
27
class Customer
28
{
29
    const IS_ENABLED_PATH = 'two_factor_customers/details/enable';
30
    const COMPANY_NAME_PATH = 'two_factor_customers/details/company_name';
31
32
    /**
33
     * @var ScopeConfigInterface
34
     */
35
    private $scopeConfig;
36
37
    /**
38
     * Admin constructor.
39
     *
40
     * @param ScopeConfigInterface $scopeConfig
41
     */
42 28
    public function __construct(ScopeConfigInterface $scopeConfig)
43
    {
44 28
        $this->scopeConfig = $scopeConfig;
45 28
    }
46
47 28
    public function isTwoFactorEnabled()
48
    {
49 28
        return ($this->scopeConfig->getValue(self::IS_ENABLED_PATH, ScopeInterface::SCOPE_STORE) == true);
50
    }
51
52 2
    public function getCompanyName()
53
    {
54 2
        return $this->scopeConfig->getValue(self::COMPANY_NAME_PATH, ScopeInterface::SCOPE_STORE);
55
    }
56
}
57