Completed
Push — master ( fe66cd...3af1a2 )
by Konstantin
02:26
created

ContactService::getLink()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
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\Contact;
6
use linkprofit\AmoCRM\entities\EntityInterface;
7
8
/**
9
 * Class ContactService
10
 * @package linkprofit\AmoCRM\services
11
 */
12 View Code Duplication
class ContactService extends BaseService
1 ignored issue
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 array Contact
16
     */
17
    protected $entities = [];
18
19
    /**
20
     * @param Contact $lead
0 ignored issues
show
Bug introduced by
There is no parameter named $lead. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
21
     */
22 3
    public function add(EntityInterface $contact)
23
    {
24 3
        if ($contact instanceof Contact) {
25 3
            $this->entities[] = $contact;
26
        }
27 3
    }
28
29
    /**
30
     * @param $array
31
     * @return Contact
32
     */
33 2
    public function parseArrayToEntity($array)
34
    {
35 2
        $contact = new Contact();
36 2
        $contact->set($array);
37
38 2
        return $contact;
39
    }
40
41
    /**
42
     * @return string
43
     */
44 3
    protected function getLink()
45
    {
46 3
        return 'https://' . $this->request->getSubdomain() . '.amocrm.ru/api/v2/contacts';
47
    }
48
}