Code Duplication    Length = 33-34 lines in 2 locations

src/widgets/combo/PlanCombo.php 1 location

@@ 16-48 (lines=33) @@
13
use hiqdev\combo\Combo;
14
use yii\helpers\ArrayHelper;
15
16
class PlanCombo extends Combo
17
{
18
    /** {@inheritdoc} */
19
    public $type = 'plan/name';
20
21
    /** {@inheritdoc} */
22
    public $name = 'plan';
23
24
    /** {@inheritdoc} */
25
    public $url = '/finance/plan/index';
26
27
    /** {@inheritdoc} */
28
    public $_return = ['id'];
29
30
    /** {@inheritdoc} */
31
    public $_rename = ['text' => 'plan'];
32
33
    public $_primaryFilter = 'plan_ilike';
34
35
    /**
36
     * @var string the type of tariff
37
     * @see getFilter()
38
     */
39
    public $tariffType;
40
41
    /** {@inheritdoc} */
42
    public function getFilter()
43
    {
44
        return ArrayHelper::merge(parent::getFilter(), [
45
            'type_in' => ['format' => $this->tariffType],
46
        ]);
47
    }
48
}
49

src/widgets/TariffCombo.php 1 location

@@ 19-52 (lines=34) @@
16
/**
17
 * Class TariffCombo.
18
 */
19
class TariffCombo extends Combo
20
{
21
    /** {@inheritdoc} */
22
    public $type = 'finance/tariff';
23
24
    /** {@inheritdoc} */
25
    public $name = 'tariff';
26
27
    /** {@inheritdoc} */
28
    public $url = '/finance/tariff/search';
29
30
    /** {@inheritdoc} */
31
    public $_return = ['id'];
32
33
    public $_primaryFilter = 'tariff_ilike';
34
35
    /** @var string|null tariff owner */
36
    public $client;
37
38
    /**
39
     * @var string the type of tariff
40
     * @see getFilter()
41
     */
42
    public $tariffType;
43
44
    /** {@inheritdoc} */
45
    public function getFilter()
46
    {
47
        return ArrayHelper::merge(parent::getFilter(), [
48
            'type_in' => ['format' => $this->tariffType],
49
            'client' => ['format' => $this->client],
50
        ]);
51
    }
52
}
53