IpSearch::searchAttributes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 0
cts 21
cp 0
rs 9.584
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-2019, 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 Yii;
21
use yii\helpers\ArrayHelper;
22
23
class IpSearch extends Ip
24
{
25
    use SearchModelTrait {
26
        searchAttributes as defaultSearchAttributes;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function searchAttributes()
33
    {
34
        return ArrayHelper::merge(
35
            $this->defaultSearchAttributes(),
36
            $this->buildAttributeConditions('server'),
37
            $this->buildAttributeConditions('tag'),
38
            $this->buildAttributeConditions('soft'),
39
            $this->buildAttributeConditions('soft_type'),
40
            [
41
                'with_tags',
42
                'with_counters',
43
                'with_expanded_ips',
44
                'show_only_device_link',
45
                'with_links',
46
                'not_tags',
47
                'service_id',
48
                'ips',
49
                'server_inilike',
50
            ]
51
        );
52
    }
53
54
    public function attributeLabels()
55
    {
56
        return ArrayHelper::merge(parent::attributeLabels(), [
57
            'server_in' => Yii::t('hipanel:hosting', 'Servers'),
58
            'server_inilike' => Yii::t('hipanel:hosting', 'Servers'),
59
            'tag_in' => Yii::t('hipanel:hosting', 'Tags'),
60
            'ips' => Yii::t('hipanel:hosting', 'IPs'),
61
        ]);
62
    }
63
}
64