FacebookSettings::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://flipboxfactory.com/software/patron/license
6
 * @link       https://www.flipboxfactory.com/software/patron/
7
 */
8
9
namespace flipbox\patron\settings;
10
11
use Craft;
12
use flipbox\craft\ember\helpers\ModelHelper;
13
use League\OAuth2\Client\Provider\Facebook;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
class FacebookSettings extends BaseSettings
20
{
21
    /**
22
     * @var string
23
     */
24
    public $graphApiVersion = 'v2.10';
25
26
    /**
27
     * @throws \Twig\Error\LoaderError
28
     * @throws \Twig\Error\RuntimeError
29
     * @throws \Twig\Error\SyntaxError
30
     */
31
    public function inputHtml(): string
32
    {
33
        return Craft::$app->getView()->renderTemplate(
34
            'patron/_settings/facebook',
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
                        'graphApiVersion'
52
                    ],
53
                    'match',
54
                    'pattern' => Facebook::GRAPH_API_VERSION_REGEX
55
                ],
56
                [
57
                    [
58
                        'graphApiVersion'
59
                    ],
60
                    'required'
61
                ],
62
                [
63
                    [
64
                        'graphApiVersion'
65
                    ],
66
                    'safe',
67
                    'on' => [
68
                        ModelHelper::SCENARIO_DEFAULT
0 ignored issues
show
Deprecated Code introduced by
The constant flipbox\craft\ember\help...elper::SCENARIO_DEFAULT has been deprecated with message: Use `yii\base\Model::SCENARIO_DEFAULT`

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
69
                    ]
70
                ]
71
            ]
72
        );
73
    }
74
}
75