LayoutSettings   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 33
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getCaptchaSettings() 0 11 2
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
declare(strict_types=1);
9
10
namespace Hryvinskyi\InvisibleCaptcha\Model;
11
12
use Hryvinskyi\InvisibleCaptcha\Helper\Config\General;
13
14
/**
15
 * Class LayoutSettings
16
 */
17
class LayoutSettings
18
{
19
    /**
20
     * @var General
21
     */
22
    private $config;
23
24
    /**
25
     * LayoutSettings constructor.
26
     *
27
     * @param General $config
28
     */
29
    public function __construct(
30
        General $config
31
    ) {
32
        $this->config = $config;
33
    }
34
35
    /**
36
     * Return captcha config for frontend
37
     * @return array
38
     */
39
    public function getCaptchaSettings()
40
    {
41
        if ($this->config->hasEnabled()) {
42
            return [
43
                'siteKey' => $this->config->getSiteKey(),
44
                'lazyLoad' => $this->config->isLazyLoad(),
45
                'isDisabledSubmitForm' => $this->config->isDisabledSubmitForm()
46
            ];
47
        }
48
49
        return [];
50
    }
51
}
52