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

PipelineService::getLink()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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
9
/**
10
 * Class PipelineService
11
 * @package linkprofit\AmoCRM\services
12
 */
13
class PipelineService extends BaseService
14
{
15
    /**
16
     * @var array Pipeline
17
     */
18
    protected $entities = [];
19
20
    /**
21
     * @param Pipeline $pipeline
22
     */
23 3
    public function add(EntityInterface $pipeline)
24
    {
25 3
        if ($pipeline instanceof Pipeline) {
26 3
            $this->entities[] = $pipeline;
27 3
        }
28 3
    }
29
30
    /**
31
     * @param $array
32
     * @return Pipeline
33
     */
34 3
    public function parseArrayToEntity($array)
35
    {
36 3
        $pipeline = new Pipeline();
37 3
        $pipeline->set($array);
38
39 3
        return $pipeline;
40
    }
41
42
    /**
43
     * @return string
44
     */
45 3
    protected function getLink()
46
    {
47 3
        return 'https://' . $this->request->getSubdomain() . '.amocrm.ru/private/api/v2/json/pipelines/set';
48
    }
49
}