Code Duplication    Length = 8-9 lines in 2 locations

src/cart/ServerOrderProduct.php 1 location

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

src/cart/ServerOrderPurchase.php 1 location

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