Passed
Push — master ( f2dea1...58a092 )
by Nate
04:47
created

RecordWithId   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 52.27 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A idRules() 23 23 1
A getId() 0 4 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
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/spark/blob/master/LICENSE
6
 * @link       https://github.com/flipbox/spark
7
 */
8
9
namespace flipbox\spark\records\traits;
10
11
use flipbox\spark\helpers\RecordHelper;
12
13
/**
14
 * @property int $id
15
 *
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.2.0
18
 */
19
trait RecordWithId
20
{
21
22
    /**
23
     * @var integer
24
     */
25
    public $id;
26
27
    /**
28
     * @inheritdoc
29
     */
30 View Code Duplication
    protected function idRules()
1 ignored issue
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...
31
    {
32
33
        return [
34
            [
35
                [
36
                    'id'
37
                ],
38
                'number',
39
                'integerOnly' => true
40
            ],
41
            [
42
                [
43
                    'id'
44
                ],
45
                'safe',
46
                'on' => [
47
                    RecordHelper::SCENARIO_DEFAULT
48
                ]
49
            ]
50
        ];
51
52
    }
53
54
    /**
55
     * @inheritdoc
56
     */
57
    public function getId()
58
    {
59
        return $this->id;
60
    }
61
62
}
63