CheckEnabledVerify   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 43
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A verify() 0 7 3
1
<?php
2
/**
3
 * Copyright (c) 2019. Volodymyr Hryvinskyi.  All rights reserved.
4
 * @author: <mailto:[email protected]>
5
 * @github: <https://github.com/hryvinskyi>
6
 */
7
8
namespace Hryvinskyi\InvisibleCaptcha\Model;
9
10
use Hryvinskyi\InvisibleCaptcha\Helper\Config\Backend;
11
use Hryvinskyi\InvisibleCaptcha\Helper\Config\Frontend;
12
use Hryvinskyi\InvisibleCaptcha\Helper\Config\General;
13
14
class CheckEnabledVerify extends AbstractCheckEnabledVerify
15
{
16
    /**
17
     * @var string|null
18
     */
19
    private $configPath;
20
21
    /**
22
     * CheckEnabledVerify constructor.
23
     *
24
     * @param General $generalConfig
25
     * @param Frontend $frontendConfig
26
     * @param Backend $backendConfig
27
     * @param string $area
28
     * @param string|null $configPath
29
     */
30
    public function __construct(
31
        General $generalConfig,
32
        Frontend $frontendConfig,
33
        Backend $backendConfig,
34
        string $area,
35
        ?string $configPath
36
    ) {
37
        parent::__construct(
38
            $generalConfig,
39
            $frontendConfig,
40
            $backendConfig,
41
            $area
42
        );
43
44
        $this->configPath = $configPath;
45
    }
46
47
    /**
48
     * @inheritDoc
49
     */
50
    public function verify(): bool
51
    {
52
        if ($this->configPath) {
53
            return parent::verify() && !!$this->getGeneralConfig()->getConfigValueByPath($this->configPath);
54
        }
55
56
        return parent::verify();
57
    }
58
}
59