LayoutSettings::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
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