1 | <?php |
||
8 | abstract class BaseService implements ServiceInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var RequestHandler |
||
12 | */ |
||
13 | protected $request; |
||
14 | |||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $fields = []; |
||
19 | |||
20 | /** |
||
21 | * @var |
||
22 | */ |
||
23 | protected $response; |
||
24 | |||
25 | /** |
||
26 | * @var array EntityInterface |
||
27 | */ |
||
28 | protected $entities = []; |
||
29 | |||
30 | /** |
||
31 | * LeadService constructor. |
||
32 | * @param RequestHandler $requestHandler |
||
33 | */ |
||
34 | 6 | public function __construct(RequestHandler $requestHandler) |
|
38 | |||
39 | /** |
||
40 | * @return bool|mixed |
||
41 | */ |
||
42 | 6 | public function create() |
|
54 | |||
55 | /** |
||
56 | * @return mixed |
||
57 | */ |
||
58 | 2 | public function getResponse() |
|
62 | |||
63 | /** |
||
64 | * @return array |
||
65 | */ |
||
66 | 2 | public function getEntities() |
|
70 | |||
71 | /** |
||
72 | * @return array|bool |
||
73 | */ |
||
74 | 6 | public function parseResponseToEntities() |
|
87 | |||
88 | /** |
||
89 | * @return bool |
||
90 | */ |
||
91 | 6 | protected function checkResponse() |
|
99 | |||
100 | /** |
||
101 | * Fill fields for request |
||
102 | */ |
||
103 | 6 | protected function composeAddFields() |
|
113 | |||
114 | /** |
||
115 | * @return string |
||
116 | */ |
||
117 | abstract protected function getLink(); |
||
118 | |||
119 | /** |
||
120 | * @param $array |
||
121 | * @return EntityInterface |
||
122 | */ |
||
123 | abstract public function parseArrayToEntity($array); |
||
124 | } |