AccountCombo::getPluginOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 11
loc 11
ccs 0
cts 11
cp 0
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 1
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
namespace hipanel\modules\hosting\widgets\combo;
12
13
use hiqdev\combo\Combo;
14
use yii\helpers\ArrayHelper;
15
16
/**
17
 * Class Account.
18
 */
19 View Code Duplication
class AccountCombo extends Combo
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
{
21
    /** {@inheritdoc} */
22
    public $type = 'hosting/account';
23
24
    /** {@inheritdoc} */
25
    public $name = 'login';
26
27
    /** {@inheritdoc} */
28
    public $url = '/hosting/account/index';
29
30
    /** {@inheritdoc} */
31
    public $_return = ['id', 'client', 'client_id', 'device', 'device_id', 'account'];
32
33
    /** {@inheritdoc} */
34
    public $_rename = ['text' => 'login'];
35
36
    /**
37
     * @var string the type of client
38
     *             Used by [[getFilter]] to generate filter
39
     *
40
     * @see getFilter()
41
     */
42
    public $accountType;
43
44
    /** {@inheritdoc} */
45
    public function getFilter()
46
    {
47
        return ArrayHelper::merge(parent::getFilter(), [
48
            'client' => 'client/client',
49
            'server' => 'server/server',
50
            'type'   => ['format' => $this->accountType],
51
        ]);
52
    }
53
54
    /** {@inheritdoc} */
55
    public function getPluginOptions($options = [])
56
    {
57
        return parent::getPluginOptions([
58
            'clearWhen' => ['client/client', 'server/server'],
59
            'affects'   => [
60
                'client/seller' => 'seller',
61
                'client/client' => 'client',
62
                'server/server' => 'device',
63
            ],
64
        ]);
65
    }
66
}
67