Completed
Push — master ( 0b55a4...076988 )
by Alexey
05:20
created

Event   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 44
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 1
c 2
b 1
f 0
lcom 0
cbo 1
dl 44
loc 44
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A relations() 13 13 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
3
/**
4
 * Log event
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
12
namespace Migrations\Log;
13
14 View Code Duplication
class Event extends \Model
15
{
16
    public static $objectName = 'Событие истории миграции';
17
    public static $labels = [
18
        'type' => 'Тип',
19
        'info' => 'Информация',
20
        'date_create' => 'Дата события'
21
    ];
22
    public static $cols = [
23
        'type' => ['type' => 'text'],
24
        'info' => ['type' => 'textarea'],
25
        'log_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'log'],
26
        'map_path_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'path'],
27
        'date_create' => ['type' => 'dateTime'],
28
    ];
29
    public static $dataManagers = [
30
        'manager' => [
31
            'cols' => ['type', 'info', 'date_create']
32
        ]
33
    ];
34
    public static $forms = [
35
        'manager' => [
36
            'map' => [
37
                ['type'],
38
                ['info'],
39
            ]
40
        ]
41
    ];
42
43
    public static function relations()
44
    {
45
        return [
46
            'log' => [
47
                'col' => 'log_id',
48
                'model' => 'Migrations\Log'
49
            ],
50
            'path' => [
51
                'col' => 'map_path_id',
52
                'model' => 'Migrations\Migrations\Map\Path'
53
            ]
54
        ];
55
    }
56
57
}
58