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

History   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A relations() 9 9 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
 * Currency exchange rate history
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 Money\Currency\ExchangeRate;
13
14 View Code Duplication
class History extends \Model
15
{
16
    public static $cols = [
17
        'currency_exchangerate_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'rate'],
18
        'old' => ['type' => 'decimal'],
19
        'new' => ['type' => 'decimal'],
20
        'date_create' => ['type' => 'dateTime']
21
    ];
22
23
    public static function relations()
24
    {
25
        return [
26
            'rate' => [
27
                'model' => 'Money\Currency\ExchangeRate\History',
28
                'col' => 'currency_exchangerate_id'
29
            ],
30
        ];
31
    }
32
33
}
34