NoteService::parseArrayToEntity()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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