ConfigureForm   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 50
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 6 1
A attributeLabels() 0 6 1
A attributeHints() 0 6 1
A loadSettings() 0 6 1
A save() 0 6 1
1
<?php
2
3
namespace humhub\modules\twitchtv\models;
4
5
use Yii;
6
7
/**
8
 * ConfigureForm defines the configurable fields.
9
10
 */
11
class ConfigureForm extends \yii\base\Model
12
{
13
14
    public $serverUrl;
15
16
    /**
17
     * @inheritdoc
18
     */
19
    public function rules()
20
    {
21
        return [
22
            ['serverUrl', 'string'],
23
        ];
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function attributeLabels()
30
    {
31
        return [
32
            'serverUrl' => Yii::t('TwitchtvModule.base', 'Twitch URL:'),
33
        ];
34
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39
    public function attributeHints()
40
    {
41
        return [
42
            'serverUrl' => Yii::t('TwitchtvModule.base', 'e.g. https://www.twitch.tv/{id}/chat'),
43
        ];
44
    }
45
46
    public function loadSettings()
47
    {
48
        $this->serverUrl = Yii::$app->getModule('twitchtv')->settings->get('serverUrl');
49
50
        return true;
51
    }
52
53
    public function save()
54
    {
55
        Yii::$app->getModule('twitchtv')->settings->set('serverUrl', $this->serverUrl);
56
57
        return true;
58
    }
59
60
}
61