AssignHubsForm   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 3
b 0
f 0
dl 0
loc 30
ccs 0
cts 8
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A tableName() 0 3 1
A attributeLabels() 0 5 1
A rules() 0 3 1
1
<?php
2
/**
3
 * Server module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-server
6
 * @package   hipanel-module-server
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\server\forms;
12
13
use hipanel\base\ModelTrait;
14
use hipanel\modules\server\models\Server;
15
use Yii;
16
17
/**
18
 * Class AssignHubsForm.
19
 */
20
class AssignHubsForm extends Server
21
{
22
    use ModelTrait;
23
24
    /**
25
     * @var array
26
     */
27
    protected $switchVariants = ['net', 'kvm', 'pdu', 'rack', 'pdu2', 'net2', 'ipmi'];
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public static function tableName()
33
    {
34
        return 'server';
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function rules()
41
    {
42
        return array_merge(parent::rules(), $this->defaultSwitchRules(), $this->generateUniqueValidators());
43
    }
44
45
    public function attributeLabels()
46
    {
47
        return array_merge(parent::attributeLabels(), [
48
            'pdu2' => Yii::t('hipanel:server', 'APC 2'),
49
            'net2' => Yii::t('hipanel:server', 'Switch 2'),
50
        ]);
51
    }
52
}
53