Completed
Pull Request — master (#155)
by Alexander
05:49
created

ComparisonItems   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 4
c 3
b 1
f 1
lcom 0
cbo 1
dl 58
loc 58
ccs 10
cts 10
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getMetrics() 4 4 1
A setDimensions() 5 5 1
A setMetrics() 5 5 1
A getDimensions() 4 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
namespace Yandex\Metrica\Stat\Models;
4
5
use Yandex\Metrica\Stat\Models\Dimensions;
6
use Yandex\Metrica\Stat\Models\ComparisonMetrics;
7
use Yandex\Common\Model;
8
9 View Code Duplication
class ComparisonItems extends Model
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...
10
{
11
12
    protected $dimensions = null;
13
14
    protected $metrics = null;
15
16
    protected $mappingClasses = [
17
        'dimensions' => 'Yandex\Metrica\Stat\Models\Dimensions',
18
        'metrics' => 'Yandex\Metrica\Stat\Models\ComparisonMetrics'
19
    ];
20
21
    protected $propNameMap = [];
22
23
    /**
24
     * Retrieve the dimensions property
25
     *
26
     * @return Dimensions|null
27
     */
28 1
    public function getDimensions()
29
    {
30 1
        return $this->dimensions;
31
    }
32
33
    /**
34
     * Set the dimensions property
35
     *
36
     * @param Dimensions $dimensions
37
     * @return $this
38
     */
39 1
    public function setDimensions($dimensions)
40
    {
41 1
        $this->dimensions = $dimensions;
42 1
        return $this;
43
    }
44
45
    /**
46
     * Retrieve the metrics property
47
     *
48
     * @return ComparisonMetrics|null
49
     */
50 2
    public function getMetrics()
51
    {
52 2
        return $this->metrics;
53
    }
54
55
    /**
56
     * Set the metrics property
57
     *
58
     * @param ComparisonMetrics $metrics
59
     * @return $this
60
     */
61 1
    public function setMetrics($metrics)
62
    {
63 1
        $this->metrics = $metrics;
64 1
        return $this;
65
    }
66
}
67