Completed
Pull Request — master (#39)
by
unknown
05:32
created

CustomOffer::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: execut
5
 * Date: 4/28/17
6
 * Time: 10:11 AM
7
 */
8
9
namespace pastuhov\ymlcatalog\models;
10
11
12
use yii\helpers\ArrayHelper;
13
14
class CustomOffer extends Offer
15
{
16
    public $model;
17
    public $vendor;
18
    public $vendorCode;
19
    public $typePrefix;
20
    public $type = 'vendor.model';
21
    /**
22
     * @inheritdoc
23
     */
24
    public static function getTagProperties() {
25
        return ArrayHelper::merge(parent::getTagProperties(), [
26
            'type'
27
        ]);
28
    }
29
30
    public function getYmlAttributes()
31
    {
32
        return ArrayHelper::merge(parent::getYmlAttributes(), [
33
            'model',
34
            'vendor',
35
            'vendorCode',
36
            'typePrefix',
37
        ]);
38
    }
39
    /**
40
     * @inheritdoc
41
     */
42 View Code Duplication
    public function rules()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
    {
44
        return ArrayHelper::merge(parent::rules(), [
45
            [['type', 'model', 'vendor'], 'required'],
46
            [['model', 'vendor', 'vendorCode', 'typePrefix'], 'string', 'max' => 200],
47
        ]);
48
    }
49
}