AssignHubsForm::tableName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
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