Completed
Push — master ( 2d7b6e...0da056 )
by Aleksander
04:51
created

Stats   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 77.78%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 29
loc 29
ccs 7
cts 9
cp 0.7778
rs 10
c 1
b 0
f 0
wmc 5
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 9 9 4
A getAll() 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
namespace Yandex\Market\Partner\Models;
3
4
use Yandex\Common\ObjectModel;
5
6 View Code Duplication
class Stats extends ObjectModel
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...
7
{
8
    protected $collection = [];
9
10
    protected $mappingClasses = [];
11
12
    protected $propNameMap = [];
13
14
    /**
15
     * Add item
16
     */
17 1
    public function add($stat)
18
    {
19 1
        if (is_array($stat)) {
20 1
            $this->collection[] = new Stat($stat);
21 1
        } elseif (is_object($stat) && $stat instanceof Stat) {
22
            $this->collection[] = $stat;
23
        }
24 1
        return $this;
25
    }
26
27
    /**
28
     * Get items
29
     */
30 1
    public function getAll()
31
    {
32 1
        return $this->collection;
33
    }
34
}
35