Code Duplication    Length = 48-48 lines in 2 locations

src/widgets/combo/AccountCombo.php 1 location

@@ 19-66 (lines=48) @@
16
/**
17
 * Class Account.
18
 */
19
class AccountCombo extends Combo
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

src/widgets/combo/ServiceCombo.php 1 location

@@ 19-66 (lines=48) @@
16
/**
17
 * Class Service.
18
 */
19
class ServiceCombo extends Combo
20
{
21
    /** {@inheritdoc} */
22
    public $name = 'name';
23
24
    /** {@inheritdoc} */
25
    public $type = 'hosting/service';
26
27
    /** {@inheritdoc} */
28
    public $url = '/hosting/service/index';
29
30
    /** {@inheritdoc} */
31
    public $_return = ['id', 'client', 'client_id', 'server', 'server_id', 'seller', 'seller_id', 'soft'];
32
33
    /** {@inheritdoc} */
34
    public $_rename = ['text' => 'name'];
35
36
    /** {@inheritdoc} */
37
    public $_filter = [
38
        'client' => 'client/client',
39
        'server' => 'server/server',
40
    ];
41
42
    /**
43
     * @var string the soft type, used by [[getFilter]] to filter by the soft type
44
     * @see getFilter()
45
     */
46
    public $softType;
47
48
    public $_pluginOptions = [
49
        'activeWhen' => [
50
            'server/server',
51
        ],
52
        'affects'    => [
53
            'client/seller' => 'seller',
54
            'client/client' => 'client',
55
            'server/server' => 'server',
56
        ],
57
    ];
58
59
    /** {@inheritdoc} */
60
    public function getFilter()
61
    {
62
        return ArrayHelper::merge(parent::getFilter(), [
63
            'soft_type' => ['format' => $this->softType],
64
        ]);
65
    }
66
}
67