@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function getProject($id) |
92 | 92 | { |
93 | - $url = '/project/' . $id; |
|
93 | + $url = '/project/'.$id; |
|
94 | 94 | |
95 | 95 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
96 | 96 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $project = intval($project); |
116 | 116 | } |
117 | 117 | |
118 | - $url = '/project/' . $project . '/customs'; |
|
118 | + $url = '/project/'.$project.'/customs'; |
|
119 | 119 | |
120 | 120 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
121 | 121 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $project = intval($project); |
144 | 144 | } |
145 | 145 | |
146 | - $url = '/project/' . $project . '/fields'; |
|
146 | + $url = '/project/'.$project.'/fields'; |
|
147 | 147 | |
148 | 148 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
149 | 149 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $project = intval($project); |
172 | 172 | } |
173 | 173 | |
174 | - $url = '/project/' . $project . '/callback-url'; |
|
174 | + $url = '/project/'.$project.'/callback-url'; |
|
175 | 175 | LPTrackerRequest::sendRequest($url, ['url' => $callbackUrl], 'PUT', $this->token, $this->address); |
176 | 176 | } |
177 | 177 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | throw new LPTrackerSDKException('Invalid contact ID'); |
247 | 247 | } |
248 | 248 | |
249 | - $url = '/contact/' . $contact; |
|
249 | + $url = '/contact/'.$contact; |
|
250 | 250 | |
251 | 251 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
252 | 252 | |
@@ -264,12 +264,12 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function saveContact(Contact $contact) |
266 | 266 | { |
267 | - if (!$contact->validate()) { |
|
267 | + if ( ! $contact->validate()) { |
|
268 | 268 | throw new LPTrackerSDKException('Invalid contact'); |
269 | 269 | } |
270 | 270 | |
271 | 271 | $data = $contact->toArray(); |
272 | - if (!empty($data['fields'])) { |
|
272 | + if ( ! empty($data['fields'])) { |
|
273 | 273 | $fields = []; |
274 | 274 | foreach ($data['fields'] as $field) { |
275 | 275 | $fields[$field['id']] = $field['value']; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | if ($contact->getId() > 0) { |
281 | - $url = '/contact/' . $contact->getId(); |
|
281 | + $url = '/contact/'.$contact->getId(); |
|
282 | 282 | |
283 | 283 | $response = LPTrackerRequest::sendRequest($url, $contact->toArray(), 'PUT', $this->token, $this->address); |
284 | 284 | } else { |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $data['phone'] = $searchOptions['phone']; |
363 | 363 | } |
364 | 364 | |
365 | - $url = $url . http_build_query($data); |
|
365 | + $url = $url.http_build_query($data); |
|
366 | 366 | |
367 | 367 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
368 | 368 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | throw new LPTrackerSDKException('Invalid contact id'); |
392 | 392 | } |
393 | 393 | |
394 | - $url = '/contact/' . $contact . '/leads'; |
|
394 | + $url = '/contact/'.$contact.'/leads'; |
|
395 | 395 | |
396 | 396 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
397 | 397 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $field = $field->getId(); |
423 | 423 | } |
424 | 424 | |
425 | - $url = '/contact/' . $contact . '/field/' . $field; |
|
425 | + $url = '/contact/'.$contact.'/field/'.$field; |
|
426 | 426 | |
427 | 427 | $data = [ |
428 | 428 | 'value' => $newValue |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | } |
453 | 453 | |
454 | 454 | $view = new View($viewData); |
455 | - if (!$view->validate()) { |
|
455 | + if ( ! $view->validate()) { |
|
456 | 456 | throw new LPTrackerSDKException('Invalid view data'); |
457 | 457 | } |
458 | 458 | |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | throw new LPTrackerSDKException('Invalid view ID'); |
485 | 485 | } |
486 | 486 | |
487 | - $url = '/view/' . $view; |
|
487 | + $url = '/view/'.$view; |
|
488 | 488 | |
489 | 489 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
490 | 490 | |
@@ -502,12 +502,12 @@ discard block |
||
502 | 502 | */ |
503 | 503 | public function saveView(View $view) |
504 | 504 | { |
505 | - if (!$view->validate()) { |
|
505 | + if ( ! $view->validate()) { |
|
506 | 506 | throw new LPTrackerSDKException('Invalid view'); |
507 | 507 | } |
508 | 508 | |
509 | 509 | if ($view->getId() > 0) { |
510 | - $url = '/view/' . $view->getId(); |
|
510 | + $url = '/view/'.$view->getId(); |
|
511 | 511 | |
512 | 512 | $response = LPTrackerRequest::sendRequest($url, $view->toArray(), 'PUT', $this->token, $this->address); |
513 | 513 | } else { |
@@ -555,11 +555,11 @@ discard block |
||
555 | 555 | } |
556 | 556 | |
557 | 557 | $lead = new Lead($leadData); |
558 | - if (!$lead->validate()) { |
|
558 | + if ( ! $lead->validate()) { |
|
559 | 559 | throw new LPTrackerSDKException('Invalid lead data'); |
560 | 560 | } |
561 | 561 | |
562 | - if (!empty($lead->getView()) && empty($lead->getView()->getId())) { |
|
562 | + if ( ! empty($lead->getView()) && empty($lead->getView()->getId())) { |
|
563 | 563 | $contactModel = $this->getContact($contact); |
564 | 564 | $viewData = $lead->getView()->toArray(); |
565 | 565 | $lead->setView($this->createView($contactModel->getProjectId(), $viewData)); |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | } |
572 | 572 | if (isset($leadData['view_id'])) { |
573 | 573 | $data['view_id'] = intval($leadData['view_id']); |
574 | - } else if (!empty($lead->getView()) && !empty($lead->getView()->getId())) { |
|
574 | + } else if ( ! empty($lead->getView()) && ! empty($lead->getView()->getId())) { |
|
575 | 575 | $data['view_id'] = $lead->getView()->getId(); |
576 | 576 | } |
577 | 577 | |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | throw new LPTrackerSDKException('Invalid lead ID'); |
602 | 602 | } |
603 | 603 | |
604 | - $url = '/lead/' . $lead; |
|
604 | + $url = '/lead/'.$lead; |
|
605 | 605 | |
606 | 606 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
607 | 607 | |
@@ -619,12 +619,12 @@ discard block |
||
619 | 619 | */ |
620 | 620 | public function saveLead(Lead $lead) |
621 | 621 | { |
622 | - if (!$lead->validate()) { |
|
622 | + if ( ! $lead->validate()) { |
|
623 | 623 | throw new LPTrackerSDKException('Invalid lead'); |
624 | 624 | } |
625 | 625 | |
626 | 626 | if ($lead->getId() > 0) { |
627 | - $url = '/lead/' . $lead->getId(); |
|
627 | + $url = '/lead/'.$lead->getId(); |
|
628 | 628 | |
629 | 629 | $response = LPTrackerRequest::sendRequest($url, $lead->toArray(true), 'PUT', $this->token, $this->address); |
630 | 630 | } else { |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | throw new LPTrackerSDKException('Invalid lead ID'); |
690 | 690 | } |
691 | 691 | |
692 | - $url = '/lead/' . $lead . '/payment'; |
|
692 | + $url = '/lead/'.$lead.'/payment'; |
|
693 | 693 | |
694 | 694 | $data = [ |
695 | 695 | 'category' => $category, |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | $lead = $lead->getId(); |
719 | 719 | } |
720 | 720 | |
721 | - $url = '/lead/' . $lead . '/funnel'; |
|
721 | + $url = '/lead/'.$lead.'/funnel'; |
|
722 | 722 | |
723 | 723 | $data = [ |
724 | 724 | 'funnel' => $newFunnelId |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $lead = intval($lead); |
748 | 748 | } |
749 | 749 | |
750 | - $url = '/lead/' . $lead . '/comments'; |
|
750 | + $url = '/lead/'.$lead.'/comments'; |
|
751 | 751 | |
752 | 752 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
753 | 753 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | $lead = intval($lead); |
777 | 777 | } |
778 | 778 | |
779 | - $url = '/lead/' . $lead . '/comment'; |
|
779 | + $url = '/lead/'.$lead.'/comment'; |
|
780 | 780 | |
781 | 781 | $data = [ |
782 | 782 | 'text' => $text |
@@ -803,13 +803,13 @@ discard block |
||
803 | 803 | { |
804 | 804 | $leadId = $lead instanceof Lead |
805 | 805 | ? $lead->getId() |
806 | - : (int)$lead; |
|
806 | + : (int) $lead; |
|
807 | 807 | |
808 | 808 | $customId = $custom instanceof Custom |
809 | 809 | ? $custom->getId() |
810 | - : (int)$custom; |
|
810 | + : (int) $custom; |
|
811 | 811 | |
812 | - $url = '/lead/' . $leadId . '/file'; |
|
812 | + $url = '/lead/'.$leadId.'/file'; |
|
813 | 813 | $data = [ |
814 | 814 | 'name' => pathinfo($absolutePath, PATHINFO_BASENAME), |
815 | 815 | 'mime' => mime_content_type($absolutePath), |
@@ -828,11 +828,11 @@ discard block |
||
828 | 828 | */ |
829 | 829 | public function saveLeadCustom(Custom $custom) |
830 | 830 | { |
831 | - if (!$custom->validate() || empty($custom->getLeadId())) { |
|
831 | + if ( ! $custom->validate() || empty($custom->getLeadId())) { |
|
832 | 832 | throw new LPTrackerSDKException('Invalid custom'); |
833 | 833 | } |
834 | 834 | |
835 | - $url = '/lead/' . $custom->getLeadId() . '/custom/' . $custom->getId(); |
|
835 | + $url = '/lead/'.$custom->getLeadId().'/custom/'.$custom->getId(); |
|
836 | 836 | |
837 | 837 | $data = [ |
838 | 838 | 'value' => $custom->getValue() |
@@ -894,8 +894,8 @@ discard block |
||
894 | 894 | */ |
895 | 895 | public function createCustom($project, $options) |
896 | 896 | { |
897 | - $projectId = $project instanceof Project ? $project->getId() : (int)$project; |
|
898 | - $actionUrl = '/custom/' . $projectId . '/create'; |
|
897 | + $projectId = $project instanceof Project ? $project->getId() : (int) $project; |
|
898 | + $actionUrl = '/custom/'.$projectId.'/create'; |
|
899 | 899 | $response = LPTrackerRequest::sendRequest($actionUrl, $options, 'POST', $this->token, $this->address); |
900 | 900 | |
901 | 901 | return new CustomField($response); |
@@ -918,9 +918,9 @@ discard block |
||
918 | 918 | */ |
919 | 919 | public function getLeadsList($project, $offset = null, $limit = null, $sort = [], $isDeal = false, $filter = []) |
920 | 920 | { |
921 | - $projectId = $project instanceof Project ? $project->getId() : (int)$project; |
|
921 | + $projectId = $project instanceof Project ? $project->getId() : (int) $project; |
|
922 | 922 | |
923 | - $actionUrl = '/lead/' . $projectId . '/list?' . http_build_query([ |
|
923 | + $actionUrl = '/lead/'.$projectId.'/list?'.http_build_query([ |
|
924 | 924 | 'offset' => $offset, |
925 | 925 | 'limit' => $limit, |
926 | 926 | 'sort' => $sort, |