Code Duplication    Length = 30-33 lines in 2 locations

src/widgets/combo/PlanCombo.php 1 location

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

src/widgets/TariffCombo.php 1 location

@@ 19-48 (lines=30) @@
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
    /**
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