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

NoteService   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 6 2
A parseArrayToEntity() 0 7 1
A getLink() 0 4 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
}