@@ 12-48 (lines=37) @@ | ||
9 | * Class CompanyService |
|
10 | * @package linkprofit\AmoCRM\services |
|
11 | */ |
|
12 | class CompanyService extends BaseService |
|
13 | { |
|
14 | /** |
|
15 | * @var Company[] |
|
16 | */ |
|
17 | protected $entities = []; |
|
18 | ||
19 | /** |
|
20 | * @param Company $company |
|
21 | */ |
|
22 | public function add(EntityInterface $company) |
|
23 | { |
|
24 | if ($company instanceof Company) { |
|
25 | $this->entities[] = $company; |
|
26 | } |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @param $array |
|
31 | * @return Company |
|
32 | */ |
|
33 | public function parseArrayToEntity($array) |
|
34 | { |
|
35 | $company = new Company(); |
|
36 | $company->set($array); |
|
37 | ||
38 | return $company; |
|
39 | } |
|
40 | ||
41 | /** |
|
42 | * @return string |
|
43 | */ |
|
44 | protected function getLink() |
|
45 | { |
|
46 | return 'https://' . $this->request->getSubdomain() . '.amocrm.ru/api/v2/companies'; |
|
47 | } |
|
48 | } |
@@ 12-48 (lines=37) @@ | ||
9 | * Class ContactService |
|
10 | * @package linkprofit\AmoCRM\services |
|
11 | */ |
|
12 | class ContactService extends BaseService |
|
13 | { |
|
14 | /** |
|
15 | * @var 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 | } |
@@ 13-50 (lines=38) @@ | ||
10 | * Class CustomerService |
|
11 | * @package linkprofit\AmoCRM\services |
|
12 | */ |
|
13 | class CustomerService extends BaseService |
|
14 | { |
|
15 | /** |
|
16 | * @var Customer[] |
|
17 | */ |
|
18 | protected $entities = []; |
|
19 | ||
20 | /** |
|
21 | * @param Customer $customer |
|
22 | */ |
|
23 | public function add(EntityInterface $customer) |
|
24 | { |
|
25 | if ($customer instanceof Customer) { |
|
26 | $this->entities[] = $customer; |
|
27 | } |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * @param $array |
|
32 | * @return Customer |
|
33 | */ |
|
34 | public function parseArrayToEntity($array) |
|
35 | { |
|
36 | $customer = new Customer(); |
|
37 | $customer->set($array); |
|
38 | ||
39 | return $customer; |
|
40 | } |
|
41 | ||
42 | /** |
|
43 | * @return string |
|
44 | */ |
|
45 | protected function getLink() |
|
46 | { |
|
47 | return 'https://' . $this->request->getSubdomain() . '.amocrm.ru/api/v2/customers'; |
|
48 | } |
|
49 | ||
50 | } |
@@ 13-50 (lines=38) @@ | ||
10 | * Class FieldService |
|
11 | * @package linkprofit\AmoCRM\services |
|
12 | */ |
|
13 | class FieldService extends BaseService |
|
14 | { |
|
15 | /** |
|
16 | * @var Field[] |
|
17 | */ |
|
18 | protected $entities = []; |
|
19 | ||
20 | /** |
|
21 | * @param Field $field |
|
22 | */ |
|
23 | public function add(EntityInterface $field) |
|
24 | { |
|
25 | if ($field instanceof Field) { |
|
26 | $this->entities[] = $field; |
|
27 | } |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * @param $array |
|
32 | * @return Field |
|
33 | */ |
|
34 | public function parseArrayToEntity($array) |
|
35 | { |
|
36 | $field = new Field(); |
|
37 | $field->set($array); |
|
38 | ||
39 | return $field; |
|
40 | } |
|
41 | ||
42 | /** |
|
43 | * @return string |
|
44 | */ |
|
45 | protected function getLink() |
|
46 | { |
|
47 | return 'https://' . $this->request->getSubdomain() . '.amocrm.ru/api/v2/fields'; |
|
48 | } |
|
49 | ||
50 | } |
@@ 13-50 (lines=38) @@ | ||
10 | * Class LeadService |
|
11 | * @package linkprofit\AmoCRM\services |
|
12 | */ |
|
13 | class LeadService extends BaseService |
|
14 | { |
|
15 | /** |
|
16 | * @var 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 | } |
@@ 12-49 (lines=38) @@ | ||
9 | * Class NoteService |
|
10 | * @package linkprofit\AmoCRM\services |
|
11 | */ |
|
12 | class NoteService extends BaseService |
|
13 | { |
|
14 | /** |
|
15 | * @var Note[] |
|
16 | */ |
|
17 | protected $entities = []; |
|
18 | ||
19 | /** |
|
20 | * @param Note $note |
|
21 | */ |
|
22 | public function add(EntityInterface $note) |
|
23 | { |
|
24 | if ($note instanceof Note) { |
|
25 | $this->entities[] = $note; |
|
26 | } |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @param $array |
|
31 | * @return Note |
|
32 | */ |
|
33 | public function parseArrayToEntity($array) |
|
34 | { |
|
35 | $task = new Note(); |
|
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/notes'; |
|
47 | } |
|
48 | ||
49 | } |
@@ 13-49 (lines=37) @@ | ||
10 | * Class PipelineService |
|
11 | * @package linkprofit\AmoCRM\services |
|
12 | */ |
|
13 | class PipelineService extends BaseService |
|
14 | { |
|
15 | /** |
|
16 | * @var Pipeline[] |
|
17 | */ |
|
18 | protected $entities = []; |
|
19 | ||
20 | /** |
|
21 | * @param Pipeline $pipeline |
|
22 | */ |
|
23 | public function add(EntityInterface $pipeline) |
|
24 | { |
|
25 | if ($pipeline instanceof Pipeline) { |
|
26 | $this->entities[] = $pipeline; |
|
27 | } |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * @param $array |
|
32 | * @return Pipeline |
|
33 | */ |
|
34 | public function parseArrayToEntity($array) |
|
35 | { |
|
36 | $pipeline = new Pipeline(); |
|
37 | $pipeline->set($array); |
|
38 | ||
39 | return $pipeline; |
|
40 | } |
|
41 | ||
42 | /** |
|
43 | * @return string |
|
44 | */ |
|
45 | protected function getLink() |
|
46 | { |
|
47 | return 'https://' . $this->request->getSubdomain() . '.amocrm.ru/private/api/v2/json/pipelines/set'; |
|
48 | } |
|
49 | } |
@@ 12-49 (lines=38) @@ | ||
9 | * Class TaskService |
|
10 | * @package linkprofit\AmoCRM\services |
|
11 | */ |
|
12 | class TaskService extends BaseService |
|
13 | { |
|
14 | /** |
|
15 | * @var Task[] |
|
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 | } |