@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | public function validate() |
72 | 72 | { |
73 | 73 | if (empty($this->type)) { |
74 | - throw new LPTrackerSDKException('Detail type can not be null: ' . $this->__toString()); |
|
74 | + throw new LPTrackerSDKException('Detail type can not be null: '.$this->__toString()); |
|
75 | 75 | } |
76 | 76 | |
77 | - if (!in_array($this->type, self::getAllTypes(), true)) { |
|
78 | - throw new LPTrackerSDKException('Detail type not in (' . implode(',', self::getAllTypes()) . '): ' . $this->__toString()); |
|
77 | + if ( ! in_array($this->type, self::getAllTypes(), true)) { |
|
78 | + throw new LPTrackerSDKException('Detail type not in ('.implode(',', self::getAllTypes()).'): '.$this->__toString()); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | if (empty($this->data)) { |
82 | - throw new LPTrackerSDKException('Detail data can not be null: ' . $this->__toString()); |
|
82 | + throw new LPTrackerSDKException('Detail data can not be null: '.$this->__toString()); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | return true; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'data' => $this->data, |
96 | 96 | ]; |
97 | 97 | |
98 | - if (!empty($this->id)) { |
|
98 | + if ( ! empty($this->id)) { |
|
99 | 99 | $result['id'] = $this->getId(); |
100 | 100 | } |
101 | 101 | return $result; |
@@ -79,19 +79,19 @@ |
||
79 | 79 | $result = [ |
80 | 80 | 'project_id' => $this->getProjectId(), |
81 | 81 | ]; |
82 | - if (!empty($this->id)) { |
|
82 | + if ( ! empty($this->id)) { |
|
83 | 83 | $result['id'] = $this->getId(); |
84 | 84 | } |
85 | - if (!empty($this->source)) { |
|
85 | + if ( ! empty($this->source)) { |
|
86 | 86 | $result['source'] = $this->getSource(); |
87 | 87 | } |
88 | - if (!empty($this->campaign)) { |
|
88 | + if ( ! empty($this->campaign)) { |
|
89 | 89 | $result['campaign'] = $this->getCampaign(); |
90 | 90 | } |
91 | - if (!empty($this->keyword)) { |
|
91 | + if ( ! empty($this->keyword)) { |
|
92 | 92 | $result['keyword'] = $this->getKeyword(); |
93 | 93 | } |
94 | - if (!empty($this->seoSystem)) { |
|
94 | + if ( ! empty($this->seoSystem)) { |
|
95 | 95 | $result['seo_system'] = $this->getSeoSystem(); |
96 | 96 | } |
97 | 97 | return $result; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function validate() |
76 | 76 | { |
77 | 77 | if (empty($this->id)) { |
78 | - throw new LPTrackerSDKException('Field id can not be null: ' . $this->__toString()); |
|
78 | + throw new LPTrackerSDKException('Field id can not be null: '.$this->__toString()); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return true; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'name' => $this->name, |
92 | 92 | 'type' => $this->type, |
93 | 93 | ]; |
94 | - if (!empty($this->value)) { |
|
94 | + if ( ! empty($this->value)) { |
|
95 | 95 | $result['value'] = $this->getValue(); |
96 | 96 | } |
97 | 97 | return $result; |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | |
29 | 29 | public function __construct(array $commentData = []) |
30 | 30 | { |
31 | - if (!empty($commentData['id'])) { |
|
31 | + if ( ! empty($commentData['id'])) { |
|
32 | 32 | $this->id = (int) $commentData['id']; |
33 | 33 | } |
34 | - if (!empty($commentData['text'])) { |
|
34 | + if ( ! empty($commentData['text'])) { |
|
35 | 35 | $this->text = $commentData['text']; |
36 | 36 | } |
37 | - if (!empty($commentData['author'])) { |
|
37 | + if ( ! empty($commentData['author'])) { |
|
38 | 38 | if ($commentData['author']['type'] === 'main') { |
39 | 39 | $this->ownerId = 0; |
40 | 40 | } else { |
41 | 41 | $this->ownerId = (int) $commentData['author']['id']; |
42 | 42 | } |
43 | 43 | } |
44 | - if (!empty($commentData['created_at'])) { |
|
44 | + if ( ! empty($commentData['created_at'])) { |
|
45 | 45 | $this->setCreatedAt($commentData['created_at']); |
46 | 46 | } |
47 | 47 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function setCreatedAt($createdAt) |
122 | 122 | { |
123 | - if (!$createdAt instanceof \DateTime) { |
|
123 | + if ( ! $createdAt instanceof \DateTime) { |
|
124 | 124 | $createdAt = \DateTime::createFromFormat('d.m.Y H:i:s', $createdAt); |
125 | 125 | } |
126 | 126 | $this->createdAt = $createdAt; |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function __construct(array $customData = [], $leadId = 0) |
39 | 39 | { |
40 | - if (!empty($customData['id'])) { |
|
40 | + if ( ! empty($customData['id'])) { |
|
41 | 41 | $this->id = $customData['id']; |
42 | 42 | } |
43 | - if (!empty($customData['type'])) { |
|
43 | + if ( ! empty($customData['type'])) { |
|
44 | 44 | $this->type = $customData['type']; |
45 | 45 | } |
46 | - if (!empty($customData['name'])) { |
|
46 | + if ( ! empty($customData['name'])) { |
|
47 | 47 | $this->name = $customData['name']; |
48 | 48 | } |
49 | - if (!empty($customData['value'])) { |
|
49 | + if ( ! empty($customData['value'])) { |
|
50 | 50 | $this->value = $customData['value']; |
51 | 51 | } |
52 | 52 | if ($leadId > 0) { |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | $result = [ |
63 | 63 | 'id' => $this->id, |
64 | 64 | ]; |
65 | - if (!empty($this->type)) { |
|
65 | + if ( ! empty($this->type)) { |
|
66 | 66 | $result['type'] = $this->type; |
67 | 67 | } |
68 | - if (!empty($this->name)) { |
|
68 | + if ( ! empty($this->name)) { |
|
69 | 69 | $result['name'] = $this->name; |
70 | 70 | } |
71 | - if (!empty($this->value)) { |
|
71 | + if ( ! empty($this->value)) { |
|
72 | 72 | $result['value'] = $this->value; |
73 | 73 | } |
74 | 74 | return $result; |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | |
24 | 24 | public function __construct(array $paymentData = []) |
25 | 25 | { |
26 | - if (!empty($paymentData['category'])) { |
|
26 | + if ( ! empty($paymentData['category'])) { |
|
27 | 27 | $this->category = $paymentData['category']; |
28 | 28 | } |
29 | - if (!empty($paymentData['purpose'])) { |
|
29 | + if ( ! empty($paymentData['purpose'])) { |
|
30 | 30 | $this->purpose = $paymentData['purpose']; |
31 | 31 | } |
32 | - if (!empty($paymentData['sum'])) { |
|
32 | + if ( ! empty($paymentData['sum'])) { |
|
33 | 33 | $this->sum = $paymentData['sum']; |
34 | 34 | } |
35 | 35 | } |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | public function toArray() |
41 | 41 | { |
42 | 42 | $result = []; |
43 | - if (!empty($this->category)) { |
|
43 | + if ( ! empty($this->category)) { |
|
44 | 44 | $result['category'] = $this->getCategory(); |
45 | 45 | } |
46 | - if (!empty($this->purpose)) { |
|
46 | + if ( ! empty($this->purpose)) { |
|
47 | 47 | $result['purpose'] = $this->getPurpose(); |
48 | 48 | } |
49 | - if (!empty($this->sum)) { |
|
49 | + if ( ! empty($this->sum)) { |
|
50 | 50 | $result['sum'] = $this->getSum(); |
51 | 51 | } |
52 | 52 | return $result; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | throw new LPTrackerSDKException('Payment purpose is required'); |
67 | 67 | } |
68 | 68 | |
69 | - if (!isset($this->sum)) { |
|
69 | + if ( ! isset($this->sum)) { |
|
70 | 70 | throw new LPTrackerSDKException('Payment sum is required'); |
71 | 71 | } |
72 | 72 |
@@ -43,29 +43,29 @@ discard block |
||
43 | 43 | |
44 | 44 | public function __construct(array $contactData = []) |
45 | 45 | { |
46 | - if (!empty($contactData['id'])) { |
|
46 | + if ( ! empty($contactData['id'])) { |
|
47 | 47 | $this->id = (int) $contactData['id']; |
48 | 48 | } |
49 | - if (!empty($contactData['project_id'])) { |
|
49 | + if ( ! empty($contactData['project_id'])) { |
|
50 | 50 | $this->projectId = (int) $contactData['project_id']; |
51 | 51 | } |
52 | - if (!empty($contactData['name'])) { |
|
52 | + if ( ! empty($contactData['name'])) { |
|
53 | 53 | $this->name = $contactData['name']; |
54 | 54 | } |
55 | - if (!empty($contactData['profession'])) { |
|
55 | + if ( ! empty($contactData['profession'])) { |
|
56 | 56 | $this->profession = $contactData['profession']; |
57 | 57 | } |
58 | - if (!empty($contactData['site'])) { |
|
58 | + if ( ! empty($contactData['site'])) { |
|
59 | 59 | $this->site = $contactData['site']; |
60 | 60 | } |
61 | - if (!empty($contactData['details']) && is_array($contactData['details'])) { |
|
61 | + if ( ! empty($contactData['details']) && is_array($contactData['details'])) { |
|
62 | 62 | foreach ($contactData['details'] as $detail) { |
63 | 63 | $detail['contact_id'] = $this->id; |
64 | 64 | $detailModel = new ContactDetail($detail); |
65 | 65 | $this->addDetail($detailModel); |
66 | 66 | } |
67 | 67 | } |
68 | - if (!empty($contactData['fields']) && is_array($contactData['fields'])) { |
|
68 | + if ( ! empty($contactData['fields']) && is_array($contactData['fields'])) { |
|
69 | 69 | foreach ($contactData['fields'] as $fieldData) { |
70 | 70 | $fieldData['contact_id'] = $this->id; |
71 | 71 | $fieldModel = new ContactField($fieldData); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | foreach ($this->details as $detail) { |
92 | - if (!$detail->validate()) { |
|
92 | + if ( ! $detail->validate()) { |
|
93 | 93 | throw new LPTrackerSDKException('The contact does not have valid detail'); |
94 | 94 | } |
95 | 95 | } |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | 'project_id' => $this->getProjectId(), |
106 | 106 | 'details' => [], |
107 | 107 | ]; |
108 | - if (!empty($this->id)) { |
|
108 | + if ( ! empty($this->id)) { |
|
109 | 109 | $result['id'] = $this->getId(); |
110 | 110 | } |
111 | - if (!empty($this->name)) { |
|
111 | + if ( ! empty($this->name)) { |
|
112 | 112 | $result['name'] = $this->getName(); |
113 | 113 | } |
114 | - if (!empty($this->profession)) { |
|
114 | + if ( ! empty($this->profession)) { |
|
115 | 115 | $result['profession'] = $this->getProfession(); |
116 | 116 | } |
117 | - if (!empty($this->site)) { |
|
117 | + if ( ! empty($this->site)) { |
|
118 | 118 | $result['site'] = $this->getSite(); |
119 | 119 | } |
120 | 120 | foreach ($this->getDetails() as $detail) { |
@@ -58,51 +58,51 @@ discard block |
||
58 | 58 | |
59 | 59 | public function __construct(array $leadData = []) |
60 | 60 | { |
61 | - if (!empty($leadData['id'])) { |
|
61 | + if ( ! empty($leadData['id'])) { |
|
62 | 62 | $this->id = (int) $leadData['id']; |
63 | 63 | } |
64 | - if (!empty($leadData['contact_id'])) { |
|
64 | + if ( ! empty($leadData['contact_id'])) { |
|
65 | 65 | $this->contactId = (int) $leadData['contact_id']; |
66 | 66 | } |
67 | - if (!empty($leadData['name'])) { |
|
67 | + if ( ! empty($leadData['name'])) { |
|
68 | 68 | $this->name = $leadData['name']; |
69 | 69 | } |
70 | - if (!empty($leadData['funnel'])) { |
|
70 | + if ( ! empty($leadData['funnel'])) { |
|
71 | 71 | $this->funnelId = (int) $leadData['funnel']; |
72 | 72 | } |
73 | - if (!empty($leadData['stage_id'])) { |
|
73 | + if ( ! empty($leadData['stage_id'])) { |
|
74 | 74 | $this->funnelId = (int) $leadData['stage_id']; |
75 | 75 | } |
76 | - if (!empty($leadData['view'])) { |
|
76 | + if ( ! empty($leadData['view'])) { |
|
77 | 77 | $this->view = new View($leadData['view']); |
78 | 78 | } |
79 | - if (!empty($leadData['owner'])) { |
|
79 | + if ( ! empty($leadData['owner'])) { |
|
80 | 80 | $this->ownerId = (int) $leadData['owner']; |
81 | 81 | } |
82 | - if (!empty($leadData['payments']) && is_array($leadData['payments'])) { |
|
82 | + if ( ! empty($leadData['payments']) && is_array($leadData['payments'])) { |
|
83 | 83 | foreach ($leadData['payments'] as $paymentData) { |
84 | 84 | $paymentModel = new Payment($paymentData); |
85 | 85 | $this->addPayment($paymentModel); |
86 | 86 | } |
87 | 87 | } |
88 | - if (!empty($leadData['custom']) && is_array($leadData['custom'])) { |
|
88 | + if ( ! empty($leadData['custom']) && is_array($leadData['custom'])) { |
|
89 | 89 | foreach ($leadData['custom'] as $customData) { |
90 | 90 | $customModel = new Custom($customData, $this->id); |
91 | 91 | $this->addCustom($customModel); |
92 | 92 | } |
93 | 93 | } |
94 | - if (!empty($leadData['lead_date'])) { |
|
94 | + if ( ! empty($leadData['lead_date'])) { |
|
95 | 95 | $date = \DateTime::createFromFormat('d.m.Y H:i', $leadData['lead_date']); |
96 | 96 | $this->setCreatedAt($date); |
97 | 97 | } |
98 | - if (!empty($leadData['created_at'])) { |
|
98 | + if ( ! empty($leadData['created_at'])) { |
|
99 | 99 | $date = \DateTime::createFromFormat('d.m.Y H:i', $leadData['created_at']); |
100 | 100 | $this->setCreatedAt($date); |
101 | 101 | } |
102 | - if (!empty($leadData['deal_date'])) { |
|
102 | + if ( ! empty($leadData['deal_date'])) { |
|
103 | 103 | $this->options['deal_date'] = $leadData['deal_date']; |
104 | 104 | } |
105 | - if (!empty($leadData['params']) && is_array($leadData['params'])) { |
|
105 | + if ( ! empty($leadData['params']) && is_array($leadData['params'])) { |
|
106 | 106 | $this->options['params'] = $leadData['params']; |
107 | 107 | } |
108 | 108 | } |
@@ -116,22 +116,22 @@ discard block |
||
116 | 116 | $result = [ |
117 | 117 | 'contact_id' => $this->contactId, |
118 | 118 | ]; |
119 | - if (!empty($this->id)) { |
|
119 | + if ( ! empty($this->id)) { |
|
120 | 120 | $result['id'] = $this->getId(); |
121 | 121 | } |
122 | - if (!empty($this->name)) { |
|
122 | + if ( ! empty($this->name)) { |
|
123 | 123 | $result['name'] = $this->getName(); |
124 | 124 | } |
125 | - if (!empty($this->funnelId)) { |
|
125 | + if ( ! empty($this->funnelId)) { |
|
126 | 126 | $result['funnel'] = $this->getFunnelId(); |
127 | 127 | } |
128 | - if (!empty($this->ownerId)) { |
|
128 | + if ( ! empty($this->ownerId)) { |
|
129 | 129 | $result['owner'] = $this->getOwnerId(); |
130 | 130 | } |
131 | - if (!empty($this->createdAt)) { |
|
131 | + if ( ! empty($this->createdAt)) { |
|
132 | 132 | $result['lead_date'] = $this->getCreatedAt()->format('d.m.Y H:i'); |
133 | 133 | } |
134 | - if (!empty($this->view)) { |
|
134 | + if ( ! empty($this->view)) { |
|
135 | 135 | $result['view'] = $this->view->toArray(); |
136 | 136 | } |
137 | 137 | foreach ($this->getPayments() as $payment) { |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | throw new LPTrackerSDKException('Invalid contact id'); |
165 | 165 | } |
166 | 166 | |
167 | - if (!empty($this->funnelId) && (int) $this->funnelId <= 0) { |
|
167 | + if ( ! empty($this->funnelId) && (int) $this->funnelId <= 0) { |
|
168 | 168 | throw new LPTrackerSDKException('Invalid funnel ID'); |
169 | 169 | } |
170 | 170 | |
171 | - if (!empty($this->ownerId) && (int) $this->ownerId < 0) { |
|
171 | + if ( ! empty($this->ownerId) && (int) $this->ownerId < 0) { |
|
172 | 172 | throw new LPTrackerSDKException('Invalid owner ID'); |
173 | 173 | } |
174 | 174 |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } else { |
88 | 88 | $project = (int) $project; |
89 | 89 | } |
90 | - $url = '/project/' . $project; |
|
90 | + $url = '/project/'.$project; |
|
91 | 91 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
92 | 92 | return new Project($response); |
93 | 93 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } else { |
106 | 106 | $project = (int) $project; |
107 | 107 | } |
108 | - $url = '/project/' . $project . '/customs'; |
|
108 | + $url = '/project/'.$project.'/customs'; |
|
109 | 109 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
110 | 110 | $result = []; |
111 | 111 | foreach ($response as $customData) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } else { |
128 | 128 | $project = (int) $project; |
129 | 129 | } |
130 | - $url = '/project/' . $project . '/fields'; |
|
130 | + $url = '/project/'.$project.'/fields'; |
|
131 | 131 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
132 | 132 | $result = []; |
133 | 133 | foreach ($response as $customData) { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } else { |
150 | 150 | $project = (int) $project; |
151 | 151 | } |
152 | - $url = '/project/' . $project . '/callback-url'; |
|
152 | + $url = '/project/'.$project.'/callback-url'; |
|
153 | 153 | LPTrackerRequest::sendRequest($url, ['url' => $callbackUrl], 'PUT', $this->token, $this->address); |
154 | 154 | } |
155 | 155 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | throw new LPTrackerSDKException('Invalid contact ID'); |
211 | 211 | } |
212 | 212 | |
213 | - $url = '/contact/' . $contact; |
|
213 | + $url = '/contact/'.$contact; |
|
214 | 214 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
215 | 215 | return new Contact($response); |
216 | 216 | } |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function saveContact(Contact $contact) |
224 | 224 | { |
225 | - if (!$contact->validate()) { |
|
225 | + if ( ! $contact->validate()) { |
|
226 | 226 | throw new LPTrackerSDKException('Invalid contact'); |
227 | 227 | } |
228 | 228 | |
229 | 229 | $data = $contact->toArray(); |
230 | - if (!empty($data['fields'])) { |
|
230 | + if ( ! empty($data['fields'])) { |
|
231 | 231 | $fields = []; |
232 | 232 | foreach ($data['fields'] as $field) { |
233 | 233 | $fields[$field['id']] = $field['value']; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $data['fields'] = $fields; |
236 | 236 | } |
237 | 237 | if ($contact->getId() > 0) { |
238 | - $url = '/contact/' . $contact->getId(); |
|
238 | + $url = '/contact/'.$contact->getId(); |
|
239 | 239 | $response = LPTrackerRequest::sendRequest($url, $contact->toArray(), 'PUT', $this->token, $this->address); |
240 | 240 | } else { |
241 | 241 | $response = LPTrackerRequest::sendRequest( |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | if (isset($searchOptions['phone'])) { |
316 | 316 | $data['phone'] = $searchOptions['phone']; |
317 | 317 | } |
318 | - $url = '/contact/search?' . http_build_query($data); |
|
318 | + $url = '/contact/search?'.http_build_query($data); |
|
319 | 319 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
320 | 320 | $result = []; |
321 | 321 | foreach ($response as $contactData) { |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | throw new LPTrackerSDKException('Invalid contact id'); |
341 | 341 | } |
342 | 342 | |
343 | - $url = '/contact/' . $contact . '/leads'; |
|
343 | + $url = '/contact/'.$contact.'/leads'; |
|
344 | 344 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
345 | 345 | $result = []; |
346 | 346 | foreach ($response as $leadData) { |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } else { |
370 | 370 | $field = (int) $field; |
371 | 371 | } |
372 | - $url = '/contact/' . $contact . '/field/' . $field; |
|
372 | + $url = '/contact/'.$contact.'/field/'.$field; |
|
373 | 373 | $data = [ |
374 | 374 | 'value' => $newValue, |
375 | 375 | ]; |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $viewData['project_id'] = (int) $project; |
392 | 392 | } |
393 | 393 | $view = new View($viewData); |
394 | - if (!$view->validate()) { |
|
394 | + if ( ! $view->validate()) { |
|
395 | 395 | throw new LPTrackerSDKException('Invalid view data'); |
396 | 396 | } |
397 | 397 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | throw new LPTrackerSDKException('Invalid view ID'); |
417 | 417 | } |
418 | 418 | |
419 | - $url = '/view/' . $view; |
|
419 | + $url = '/view/'.$view; |
|
420 | 420 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
421 | 421 | return new View($response); |
422 | 422 | } |
@@ -428,12 +428,12 @@ discard block |
||
428 | 428 | */ |
429 | 429 | public function saveView(View $view) |
430 | 430 | { |
431 | - if (!$view->validate()) { |
|
431 | + if ( ! $view->validate()) { |
|
432 | 432 | throw new LPTrackerSDKException('Invalid view'); |
433 | 433 | } |
434 | 434 | |
435 | 435 | if ($view->getId() > 0) { |
436 | - $url = '/view/' . $view->getId(); |
|
436 | + $url = '/view/'.$view->getId(); |
|
437 | 437 | $response = LPTrackerRequest::sendRequest($url, $view->toArray(), 'PUT', $this->token, $this->address); |
438 | 438 | } else { |
439 | 439 | $response = LPTrackerRequest::sendRequest('/view', $view->toArray(), 'POST', $this->token, $this->address); |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | $leadData['contact_id'] = (int) $contact; |
475 | 475 | } |
476 | 476 | $lead = new Lead($leadData); |
477 | - if (!$lead->validate()) { |
|
477 | + if ( ! $lead->validate()) { |
|
478 | 478 | throw new LPTrackerSDKException('Invalid lead data'); |
479 | 479 | } |
480 | 480 | |
481 | - if (!empty($lead->getView()) && empty($lead->getView()->getId())) { |
|
481 | + if ( ! empty($lead->getView()) && empty($lead->getView()->getId())) { |
|
482 | 482 | $contactModel = $this->getContact($contact); |
483 | 483 | $viewData = $lead->getView()->toArray(); |
484 | 484 | $lead->setView($this->createView($contactModel->getProjectId(), $viewData)); |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | } |
490 | 490 | if (isset($leadData['view_id'])) { |
491 | 491 | $data['view_id'] = (int) $leadData['view_id']; |
492 | - } elseif (!empty($lead->getView()) && !empty($lead->getView()->getId())) { |
|
492 | + } elseif ( ! empty($lead->getView()) && ! empty($lead->getView()->getId())) { |
|
493 | 493 | $data['view_id'] = $lead->getView()->getId(); |
494 | 494 | } |
495 | 495 | $response = LPTrackerRequest::sendRequest('/lead', $data, 'POST', $this->token, $this->address); |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | throw new LPTrackerSDKException('Invalid lead ID'); |
513 | 513 | } |
514 | 514 | |
515 | - $url = '/lead/' . $lead; |
|
515 | + $url = '/lead/'.$lead; |
|
516 | 516 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
517 | 517 | return new Lead($response); |
518 | 518 | } |
@@ -524,12 +524,12 @@ discard block |
||
524 | 524 | */ |
525 | 525 | public function saveLead(Lead $lead) |
526 | 526 | { |
527 | - if (!$lead->validate()) { |
|
527 | + if ( ! $lead->validate()) { |
|
528 | 528 | throw new LPTrackerSDKException('Invalid lead'); |
529 | 529 | } |
530 | 530 | |
531 | 531 | if ($lead->getId() > 0) { |
532 | - $url = '/lead/' . $lead->getId(); |
|
532 | + $url = '/lead/'.$lead->getId(); |
|
533 | 533 | $response = LPTrackerRequest::sendRequest($url, $lead->toArray(true), 'PUT', $this->token, $this->address); |
534 | 534 | } else { |
535 | 535 | $response = LPTrackerRequest::sendRequest( |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | throw new LPTrackerSDKException('Invalid lead ID'); |
594 | 594 | } |
595 | 595 | |
596 | - $url = '/lead/' . $lead . '/payment'; |
|
596 | + $url = '/lead/'.$lead.'/payment'; |
|
597 | 597 | $data = [ |
598 | 598 | 'category' => $category, |
599 | 599 | 'purpose' => $purpose, |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | } else { |
617 | 617 | $lead = (int) $lead; |
618 | 618 | } |
619 | - $url = '/lead/' . $lead . '/funnel'; |
|
619 | + $url = '/lead/'.$lead.'/funnel'; |
|
620 | 620 | $data = [ |
621 | 621 | 'funnel' => $newFunnelId, |
622 | 622 | ]; |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | } else { |
638 | 638 | $lead = (int) $lead; |
639 | 639 | } |
640 | - $url = '/lead/' . $lead . '/comments'; |
|
640 | + $url = '/lead/'.$lead.'/comments'; |
|
641 | 641 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
642 | 642 | $result = []; |
643 | 643 | foreach ($response as $commentData) { |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | } else { |
661 | 661 | $lead = (int) $lead; |
662 | 662 | } |
663 | - $url = '/lead/' . $lead . '/comment'; |
|
663 | + $url = '/lead/'.$lead.'/comment'; |
|
664 | 664 | $data = [ |
665 | 665 | 'text' => $text, |
666 | 666 | ]; |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | } else { |
688 | 688 | $custom = (int) $custom; |
689 | 689 | } |
690 | - $url = '/lead/' . $lead . '/file'; |
|
690 | + $url = '/lead/'.$lead.'/file'; |
|
691 | 691 | $data = [ |
692 | 692 | 'name' => pathinfo($absolutePath, PATHINFO_BASENAME), |
693 | 693 | 'mime' => mime_content_type($absolutePath), |
@@ -704,11 +704,11 @@ discard block |
||
704 | 704 | */ |
705 | 705 | public function saveLeadCustom(Custom $custom) |
706 | 706 | { |
707 | - if (!$custom->validate() || empty($custom->getLeadId())) { |
|
707 | + if ( ! $custom->validate() || empty($custom->getLeadId())) { |
|
708 | 708 | throw new LPTrackerSDKException('Invalid custom'); |
709 | 709 | } |
710 | 710 | |
711 | - $url = '/lead/' . $custom->getLeadId() . '/custom/' . $custom->getId(); |
|
711 | + $url = '/lead/'.$custom->getLeadId().'/custom/'.$custom->getId(); |
|
712 | 712 | $data = [ |
713 | 713 | 'value' => $custom->getValue(), |
714 | 714 | ]; |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | } else { |
761 | 761 | $project = (int) $project; |
762 | 762 | } |
763 | - $actionUrl = '/custom/' . $project . '/create'; |
|
763 | + $actionUrl = '/custom/'.$project.'/create'; |
|
764 | 764 | $response = LPTrackerRequest::sendRequest($actionUrl, $options, 'POST', $this->token, $this->address); |
765 | 765 | return new CustomField($response); |
766 | 766 | } |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | } else { |
784 | 784 | $project = (int) $project; |
785 | 785 | } |
786 | - $actionUrl = '/lead/' . $project . '/list?' . http_build_query([ |
|
786 | + $actionUrl = '/lead/'.$project.'/list?'.http_build_query([ |
|
787 | 787 | 'offset' => $offset, |
788 | 788 | 'limit' => $limit, |
789 | 789 | 'sort' => $sort, |