HubSpotSettings   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 49
ccs 0
cts 32
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A inputHtml() 0 9 1
A rules() 0 23 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipboxfactory/patron-hubspot/blob/master/LICENSE
6
 * @link       https://github.com/flipboxfactory/patron-hubspot/
7
 */
8
9
namespace flipbox\patron\hubspot\settings;
10
11
use Craft;
12
use flipbox\patron\settings\BaseSettings;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
class HubSpotSettings extends BaseSettings
19
{
20
    /**
21
     * @var array
22
     */
23
    public $defaultScopes;
24
25
    /**
26
     * @return string
27
     * @throws \Twig_Error_Loader
28
     * @throws \yii\base\Exception
29
     */
30
    public function inputHtml(): string
31
    {
32
        return Craft::$app->getView()->renderTemplate(
33
            'patron-hubspot/providers/settings',
34
            [
35
                'settings' => $this
36
            ]
37
        );
38
    }
39
40
    /**
41
     * @inheritdoc
42
     */
43
    public function rules()
44
    {
45
        return array_merge(
46
            parent::rules(),
47
            [
48
                [
49
                    [
50
                        'defaultScopes'
51
                    ],
52
                    'required'
53
                ],
54
                [
55
                    [
56
                        'defaultScopes'
57
                    ],
58
                    'safe',
59
                    'on' => [
60
                        static::SCENARIO_DEFAULT
61
                    ]
62
                ]
63
            ]
64
        );
65
    }
66
}
67