Code Duplication    Length = 8-9 lines in 2 locations

src/cart/ServerOrderProduct.php 1 location

@@ 137-145 (lines=9) @@
134
    }
135
136
    /** {@inheritdoc} */
137
    public function rules()
138
    {
139
        return array_merge(parent::rules(), [
140
            [['cluster_id', 'tariff_id'], 'integer'],
141
            [['social', 'osimage'], 'safe'],
142
            [['tariff_id', 'purpose', 'osimage'], 'required'],
143
            [['cluster_id'], 'validateClusterId'],
144
        ]);
145
    }
146
147
    public function validateClusterId($value)
148
    {

src/cart/ServerOrderPurchase.php 1 location

@@ 38-45 (lines=8) @@
35
        $this->amount = $this->position->getQuantity();
36
    }
37
38
    public function rules()
39
    {
40
        return array_merge(parent::rules(), [
41
            [['osimage', 'cluster_id', 'purpose', 'tariff_id'], 'required'],
42
            [['osimage', 'panel', 'social', 'purpose'], 'safe'],
43
            [['tariff_id', 'cluster_id'], 'integer'],
44
        ]);
45
    }
46
47
    public function execute()
48
    {