Completed
Push — dev ( 4a164e...157791 )
by Konstantin
02:03
created

PipelineService::composeListLink()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace linkprofit\AmoCRM\services;
4
5
use linkprofit\AmoCRM\entities\EntityInterface;
6
use linkprofit\AmoCRM\entities\Pipeline;
7
use linkprofit\AmoCRM\RequestHandler;
8
use linkprofit\AmoCRM\traits\IdentifiableList;
9
10
/**
11
 * Class PipelineService
12
 * @package linkprofit\AmoCRM\services
13
 */
14 View Code Duplication
class PipelineService extends BaseService
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...
15
{
16
    use IdentifiableList;
17
18
    /**
19
     * @var Pipeline[]
20
     */
21
    protected $entities = [];
22
23
    /**
24
     * @param Pipeline $pipeline
25
     */
26 4
    public function add(EntityInterface $pipeline)
27
    {
28 4
        if ($pipeline instanceof Pipeline) {
29 4
            $this->entities[] = $pipeline;
30
        }
31 4
    }
32
33
    /**
34
     * @param $link
35
     *
36
     * @return string
37
     */
38
    protected function composeListLink($link)
39
    {
40
        $query = $this->addIdToQuery();
41
42
        $link .= '?' . http_build_query($query);
43
44
        return $link;
45
    }
46
47
    /**
48
     * @param $array
49
     * @return Pipeline
50
     */
51 4
    public function parseArrayToEntity($array)
52
    {
53 4
        $pipeline = new Pipeline();
54 4
        $pipeline->set($array);
55
56 4
        return $pipeline;
57
    }
58
59
    /**
60
     * @return string
61
     */
62 4
    protected function getLink()
63
    {
64 4
        return 'https://' . $this->request->getSubdomain() . '.amocrm.ru/private/api/v2/json/pipelines/set';
65
    }
66
}