Less   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 0
cbo 3
dl 48
loc 48
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A tableName() 4 4 1
A find() 4 4 1
A rules() 9 9 1
A attributeLabels() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
// This class was automatically generated by a giiant build task
3
// You should not change it manually as it will be overwritten on next build
4
5
namespace app\modules\prototype\models\base;
6
7
use Yii;
8
9
/**
10
 * This is the base-model class for table "app_less".
11
 *
12
 * @property integer $id
13
 * @property string $key
14
 * @property string $value
15
 */
16 View Code Duplication
abstract class Less extends \yii\db\ActiveRecord
0 ignored issues
show
Duplication introduced by
This class 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...
17
{
18
19
20
    /**
21
     * @inheritdoc
22
     */
23
    public static function tableName()
24
    {
25
        return 'app_less';
26
    }
27
28
    /**
29
     * @inheritdoc
30
     * @return \app\modules\prototype\models\query\LessQuery the active query used by this AR class.
31
     */
32
    public static function find()
33
    {
34
        return new \app\modules\prototype\models\query\LessQuery(get_called_class());
35
    }
36
37
    /**
38
     * @inheritdoc
39
     */
40
    public function rules()
41
    {
42
        return [
43
            [['key'], 'required'],
44
            [['value'], 'string'],
45
            [['key'], 'string', 'max' => 255],
46
            [['key'], 'unique']
47
        ];
48
    }
49
50
    /**
51
     * @inheritdoc
52
     */
53
    public function attributeLabels()
54
    {
55
        return [
56
            'id' => Yii::t('app', 'ID'),
57
            'key' => Yii::t('app', 'Key'),
58
            'value' => Yii::t('app', 'Value'),
59
        ];
60
    }
61
62
63
}
64