SalesforceSettings::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-salesforce/blob/master/LICENSE
6
 * @link       https://github.com/flipboxfactory/patron-salesforce/
7
 */
8
9
namespace flipbox\patron\salesforce\settings;
10
11
use Craft;
12
use flipbox\craft\ember\helpers\ModelHelper;
13
use flipbox\patron\settings\BaseSettings;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
class SalesforceSettings extends BaseSettings
20
{
21
    /**
22
     * @var string
23
     */
24
    public $domain;
25
26
    /**
27
     * @return string
28
     * @throws \Twig_Error_Loader
29
     * @throws \yii\base\Exception
30
     */
31
    public function inputHtml(): string
32
    {
33
        return Craft::$app->getView()->renderTemplate(
34
            'patron-salesforce/providers/settings',
35
            [
36
                'settings' => $this
37
            ]
38
        );
39
    }
40
41
    /**
42
     * @inheritdoc
43
     */
44
    public function rules()
45
    {
46
        return array_merge(
47
            parent::rules(),
48
            [
49
                [
50
                    [
51
                        'domain'
52
                    ],
53
                    'required'
54
                ],
55
                [
56
                    [
57
                        'domain'
58
                    ],
59
                    'url'
60
                ],
61
                [
62
                    [
63
                        'domain'
64
                    ],
65
                    'safe',
66
                    'on' => [
67
                        ModelHelper::SCENARIO_DEFAULT
68
                    ]
69
                ]
70
            ]
71
        );
72
    }
73
}
74