ConfigureForm::loadSettings()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace humhub\modules\pinterest\models;
4
5
use Yii;
6
7
/**
8
 * ConfigureForm defines the configurable fields.
9
 */
10
class ConfigureForm extends \yii\base\Model
11
{
12
13
    public $serverUrl;
14
15
    /**
16
     * @inheritdoc
17
     */
18
    public function rules()
19
    {
20
        return [
21
            ['serverUrl', 'string'],
22
        ];
23
    }
24
25
    /**
26
     * @inheritdoc
27
     */
28
    public function attributeLabels()
29
    {
30
        return [
31
            'serverUrl' => Yii::t('PinterestModule.base', 'Pinterest URL:'),
32
        ];
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function attributeHints()
39
    {
40
        return [
41
            'serverUrl' => Yii::t('PinterestModule.base', 'e.g. https://pinterest.com/{username}'),
42
        ];
43
    }
44
45
    public function loadSettings()
46
    {
47
        $this->serverUrl = Yii::$app->getModule('pinterest')->settings->get('serverUrl');
48
49
        return true;
50
    }
51
52
    public function save()
53
    {
54
        Yii::$app->getModule('pinterest')->settings->set('serverUrl', $this->serverUrl);
55
56
        return true;
57
    }
58
59
}
60