Code Duplication    Length = 37-38 lines in 3 locations

src/services/ContactService.php 1 location

@@ 12-48 (lines=37) @@
9
 * Class ContactService
10
 * @package linkprofit\AmoCRM\services
11
 */
12
class ContactService extends BaseService
13
{
14
    /**
15
     * @var array Contact
16
     */
17
    protected $entities = [];
18
19
    /**
20
     * @param Contact $contact
21
     */
22
    public function add(EntityInterface $contact)
23
    {
24
        if ($contact instanceof Contact) {
25
            $this->entities[] = $contact;
26
        }
27
    }
28
29
    /**
30
     * @param $array
31
     * @return Contact
32
     */
33
    public function parseArrayToEntity($array)
34
    {
35
        $contact = new Contact();
36
        $contact->set($array);
37
38
        return $contact;
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    protected function getLink()
45
    {
46
        return 'https://' . $this->request->getSubdomain() . '.amocrm.ru/api/v2/contacts';
47
    }
48
}

src/services/LeadService.php 1 location

@@ 13-50 (lines=38) @@
10
 * Class LeadService
11
 * @package linkprofit\AmoCRM\services
12
 */
13
class LeadService extends BaseService
14
{
15
    /**
16
     * @var array Lead
17
     */
18
    protected $entities = [];
19
20
    /**
21
     * @param Lead $lead
22
     */
23
    public function add(EntityInterface $lead)
24
    {
25
        if ($lead instanceof Lead) {
26
            $this->entities[] = $lead;
27
        }
28
    }
29
30
    /**
31
     * @param $array
32
     * @return Lead
33
     */
34
    public function parseArrayToEntity($array)
35
    {
36
        $lead = new Lead();
37
        $lead->set($array);
38
39
        return $lead;
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    protected function getLink()
46
    {
47
        return 'https://' . $this->request->getSubdomain() . '.amocrm.ru/api/v2/leads';
48
    }
49
50
}

src/services/TaskService.php 1 location

@@ 12-49 (lines=38) @@
9
 * Class TaskService
10
 * @package linkprofit\AmoCRM\services
11
 */
12
class TaskService extends BaseService
13
{
14
    /**
15
     * @var array Lead
16
     */
17
    protected $entities = [];
18
19
    /**
20
     * @param Task $task
21
     */
22
    public function add(EntityInterface $task)
23
    {
24
        if ($task instanceof Task) {
25
            $this->entities[] = $task;
26
        }
27
    }
28
29
    /**
30
     * @param $array
31
     * @return Task
32
     */
33
    public function parseArrayToEntity($array)
34
    {
35
        $task = new Task();
36
        $task->set($array);
37
38
        return $task;
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    protected function getLink()
45
    {
46
        return 'https://' . $this->request->getSubdomain() . '.amocrm.ru/api/v2/tasks';
47
    }
48
49
}