HubSpotSettings::inputHtml()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 9
cp 0
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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