Completed
Push — master ( 1565b3...a35685 )
by Konstantin
03:55 queued 01:55
created

Pipeline   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 34.88 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 15 15 3

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 linkprofit\AmoCRM\entities;
4
5
use linkprofit\AmoCRM\traits\StatusAddable;
6
7
/**
8
 * Class Pipeline
9
 * @package linkprofit\AmoCRM\entities
10
 */
11
class Pipeline extends BaseEntity
12
{
13
    /**
14
     * @var string Имя воронки
15
     */
16
    public $name;
17
18
    /**
19
     * @var integer Порядковый номер воронки при отображении
20
     */
21
    public $sort;
22
23
    /**
24
     * @var string Является ли воронка "главной" (необходимо передать значение "on", если является)
25
     */
26
    public $is_main;
27
28
    /**
29
     * @var array
30
     */
31
    protected $fieldList = ['id', 'name', 'sort', 'is_main'];
32
33
    use StatusAddable;
34
35
    /**
36
     * @return array
37
     */
38 6 View Code Duplication
    public function get()
0 ignored issues
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...
39
    {
40 6
        $statuses = [];
41 6
        foreach ($this->statuses as $status) {
42 4
            $statuses[] = $status->get();
43 6
        }
44
45 6
        $fields = $this->getExistedValues($this->fieldList);
46
47 6
        if (count($statuses)) {
48 4
            $fields['statuses'] = $statuses;
49 4
        }
50
51 6
        return $fields;
52
    }
53
}