Completed
Push — master ( 818d6c...4fa42c )
by Konstantin
01:58
created

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