Completed
Push — master ( b5070f...965752 )
by Dmitry
11s
created

HdomainSearch::attributeLabels()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Hosting Plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-hosting
6
 * @package   hipanel-module-hosting
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
/**
12
 * @see    http://hiqdev.com/hipanel-module-hosting
13
 * @license http://hiqdev.com/hipanel-module-hosting/license
14
 * @copyright Copyright (c) 2015 HiQDev
15
 */
16
17
namespace hipanel\modules\hosting\models;
18
19
use hipanel\base\SearchModelTrait;
20
use hipanel\helpers\StringHelper;
21
use Yii;
22
use yii\helpers\ArrayHelper;
23
24
class HdomainSearch extends Hdomain
25
{
26
    use SearchModelTrait {
27
        searchAttributes as defaultSearchAttributes;
28
        rules as defaultRules;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function rules()
35
    {
36
        return ArrayHelper::merge(self::defaultRules(), [
37
            [
38
                ['domain_in'],
39
                'filter',
40
                'filter' => function ($value) {
41
                    return is_array($value) ? $value : StringHelper::explode($value);
42
                },
43
            ],
44
        ]);
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function searchAttributes()
51
    {
52
        return ArrayHelper::merge($this->defaultSearchAttributes(), [
53
            'with_aliases',
54
            'with_request',
55
            'with_vhosts',
56
            'with_dns',
57
            'show_aliases_only',
58
        ]);
59
    }
60
61
    public function attributeLabels()
62
    {
63
        return $this->mergeAttributeLabels([
64
            'domain_in' => Yii::t('hipanel:hosting', 'Domain list (comma-separated)')
65
        ]);
66
    }
67
}
68