@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } else { |
91 | 91 | $project = (int) $project; |
92 | 92 | } |
93 | - $url = '/project/' . $project; |
|
93 | + $url = '/project/'.$project; |
|
94 | 94 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
95 | 95 | return new Project($response); |
96 | 96 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } else { |
120 | 120 | $project = (int) $project; |
121 | 121 | } |
122 | - $url = '/project/' . $project . '/customs'; |
|
122 | + $url = '/project/'.$project.'/customs'; |
|
123 | 123 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
124 | 124 | $result = []; |
125 | 125 | foreach ($response as $customData) { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } else { |
142 | 142 | $project = (int) $project; |
143 | 143 | } |
144 | - $url = '/project/' . $project . '/funnel'; |
|
144 | + $url = '/project/'.$project.'/funnel'; |
|
145 | 145 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
146 | 146 | $result = []; |
147 | 147 | foreach ($response as $stageData) { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } else { |
164 | 164 | $project = (int) $project; |
165 | 165 | } |
166 | - $url = '/project/' . $project . '/fields'; |
|
166 | + $url = '/project/'.$project.'/fields'; |
|
167 | 167 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
168 | 168 | $result = []; |
169 | 169 | foreach ($response as $customData) { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } else { |
186 | 186 | $project = (int) $project; |
187 | 187 | } |
188 | - $url = '/project/' . $project . '/callback-url'; |
|
188 | + $url = '/project/'.$project.'/callback-url'; |
|
189 | 189 | LPTrackerRequest::sendRequest($url, ['url' => $callbackUrl], 'PUT', $this->token, $this->address); |
190 | 190 | } |
191 | 191 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | throw new LPTrackerSDKException('Invalid contact ID'); |
262 | 262 | } |
263 | 263 | |
264 | - $url = '/contact/' . $contact; |
|
264 | + $url = '/contact/'.$contact; |
|
265 | 265 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
266 | 266 | return new Contact($response); |
267 | 267 | } |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function saveContact(Contact $contact) |
275 | 275 | { |
276 | - if (!$contact->validate()) { |
|
276 | + if ( ! $contact->validate()) { |
|
277 | 277 | throw new LPTrackerSDKException('Invalid contact'); |
278 | 278 | } |
279 | 279 | |
280 | 280 | $data = $contact->toArray(); |
281 | - if (!empty($data['fields'])) { |
|
281 | + if ( ! empty($data['fields'])) { |
|
282 | 282 | $fields = []; |
283 | 283 | foreach ($data['fields'] as $field) { |
284 | 284 | $fields[$field['id']] = $field['value']; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $data['fields'] = $fields; |
287 | 287 | } |
288 | 288 | if ($contact->getId() > 0) { |
289 | - $url = '/contact/' . $contact->getId(); |
|
289 | + $url = '/contact/'.$contact->getId(); |
|
290 | 290 | $response = LPTrackerRequest::sendRequest($url, $contact->toArray(), 'PUT', $this->token, $this->address); |
291 | 291 | } else { |
292 | 292 | $response = LPTrackerRequest::sendRequest('/contact', $contact->toArray(), 'POST', $this->token, $this->address); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | if (isset($searchOptions['phone'])) { |
361 | 361 | $data['phone'] = $searchOptions['phone']; |
362 | 362 | } |
363 | - $url = '/contact/search?' . http_build_query($data); |
|
363 | + $url = '/contact/search?'.http_build_query($data); |
|
364 | 364 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
365 | 365 | $result = []; |
366 | 366 | foreach ($response as $contactData) { |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | throw new LPTrackerSDKException('Invalid contact id'); |
386 | 386 | } |
387 | 387 | |
388 | - $url = '/contact/' . $contact . '/leads'; |
|
388 | + $url = '/contact/'.$contact.'/leads'; |
|
389 | 389 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
390 | 390 | $result = []; |
391 | 391 | foreach ($response as $leadData) { |
@@ -458,11 +458,11 @@ discard block |
||
458 | 458 | */ |
459 | 459 | public function saveContactField(ContactField $field) |
460 | 460 | { |
461 | - if (!$field->validate() || empty($field->getContactId())) { |
|
461 | + if ( ! $field->validate() || empty($field->getContactId())) { |
|
462 | 462 | throw new LPTrackerSDKException('Invalid field'); |
463 | 463 | } |
464 | 464 | |
465 | - $url = '/contact/' . $field->getContactId() . '/field/' . $field->getId(); |
|
465 | + $url = '/contact/'.$field->getContactId().'/field/'.$field->getId(); |
|
466 | 466 | if ($field->getValue() === null) { |
467 | 467 | LPTrackerRequest::sendRequest($url, [], 'DELETE', $this->token, $this->address); |
468 | 468 | $response = $field->toArray(); |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | $viewData['project_id'] = (int) $project; |
491 | 491 | } |
492 | 492 | $view = new View($viewData); |
493 | - if (!$view->validate()) { |
|
493 | + if ( ! $view->validate()) { |
|
494 | 494 | throw new LPTrackerSDKException('Invalid view data'); |
495 | 495 | } |
496 | 496 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | throw new LPTrackerSDKException('Invalid view ID'); |
516 | 516 | } |
517 | 517 | |
518 | - $url = '/view/' . $view; |
|
518 | + $url = '/view/'.$view; |
|
519 | 519 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
520 | 520 | return new View($response); |
521 | 521 | } |
@@ -527,12 +527,12 @@ discard block |
||
527 | 527 | */ |
528 | 528 | public function saveView(View $view) |
529 | 529 | { |
530 | - if (!$view->validate()) { |
|
530 | + if ( ! $view->validate()) { |
|
531 | 531 | throw new LPTrackerSDKException('Invalid view'); |
532 | 532 | } |
533 | 533 | |
534 | 534 | if ($view->getId() > 0) { |
535 | - $url = '/view/' . $view->getId(); |
|
535 | + $url = '/view/'.$view->getId(); |
|
536 | 536 | $response = LPTrackerRequest::sendRequest($url, $view->toArray(), 'PUT', $this->token, $this->address); |
537 | 537 | } else { |
538 | 538 | $response = LPTrackerRequest::sendRequest('/view', $view->toArray(), 'POST', $this->token, $this->address); |
@@ -573,11 +573,11 @@ discard block |
||
573 | 573 | $leadData['contact_id'] = (int) $contact; |
574 | 574 | } |
575 | 575 | $lead = new Lead($leadData); |
576 | - if (!$lead->validate()) { |
|
576 | + if ( ! $lead->validate()) { |
|
577 | 577 | throw new LPTrackerSDKException('Invalid lead data'); |
578 | 578 | } |
579 | 579 | |
580 | - if (!empty($lead->getView()) && empty($lead->getView()->getId())) { |
|
580 | + if ( ! empty($lead->getView()) && empty($lead->getView()->getId())) { |
|
581 | 581 | $contactModel = $this->getContact($contact); |
582 | 582 | $viewData = $lead->getView()->toArray(); |
583 | 583 | $lead->setView($this->createView($contactModel->getProjectId(), $viewData)); |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | } |
589 | 589 | if (isset($leadData['view_id'])) { |
590 | 590 | $data['view_id'] = (int) $leadData['view_id']; |
591 | - } elseif (!empty($lead->getView()) && !empty($lead->getView()->getId())) { |
|
591 | + } elseif ( ! empty($lead->getView()) && ! empty($lead->getView()->getId())) { |
|
592 | 592 | $data['view_id'] = $lead->getView()->getId(); |
593 | 593 | } |
594 | 594 | $response = LPTrackerRequest::sendRequest('/lead', $data, 'POST', $this->token, $this->address); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | throw new LPTrackerSDKException('Invalid lead ID'); |
612 | 612 | } |
613 | 613 | |
614 | - $url = '/lead/' . $lead; |
|
614 | + $url = '/lead/'.$lead; |
|
615 | 615 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
616 | 616 | return new Lead($response); |
617 | 617 | } |
@@ -640,12 +640,12 @@ discard block |
||
640 | 640 | if ($custom <= 0) { |
641 | 641 | throw new LPTrackerSDKException('Invalid custom ID'); |
642 | 642 | } |
643 | - $file = (int)$file; |
|
643 | + $file = (int) $file; |
|
644 | 644 | if ($file <= 0) { |
645 | 645 | throw new LPTrackerSDKException('Invalid file ID'); |
646 | 646 | } |
647 | 647 | |
648 | - $url = '/lead/' . $lead . '/custom/' . $custom . '/file/' . $file; |
|
648 | + $url = '/lead/'.$lead.'/custom/'.$custom.'/file/'.$file; |
|
649 | 649 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
650 | 650 | return new LeadFile($response); |
651 | 651 | } |
@@ -657,12 +657,12 @@ discard block |
||
657 | 657 | */ |
658 | 658 | public function saveLead(Lead $lead) |
659 | 659 | { |
660 | - if (!$lead->validate()) { |
|
660 | + if ( ! $lead->validate()) { |
|
661 | 661 | throw new LPTrackerSDKException('Invalid lead'); |
662 | 662 | } |
663 | 663 | |
664 | 664 | if ($lead->getId() > 0) { |
665 | - $url = '/lead/' . $lead->getId(); |
|
665 | + $url = '/lead/'.$lead->getId(); |
|
666 | 666 | $response = LPTrackerRequest::sendRequest($url, $lead->toArray(true), 'PUT', $this->token, $this->address); |
667 | 667 | } else { |
668 | 668 | $response = LPTrackerRequest::sendRequest( |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | throw new LPTrackerSDKException('Invalid lead ID'); |
727 | 727 | } |
728 | 728 | |
729 | - $url = '/lead/' . $lead . '/payment'; |
|
729 | + $url = '/lead/'.$lead.'/payment'; |
|
730 | 730 | $data = [ |
731 | 731 | 'category' => $category, |
732 | 732 | 'purpose' => $purpose, |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | } else { |
761 | 761 | $lead = (int) $lead; |
762 | 762 | } |
763 | - $url = '/lead/' . $lead . '/call'; |
|
763 | + $url = '/lead/'.$lead.'/call'; |
|
764 | 764 | LPTrackerRequest::sendRequest($url, [], 'POST', $this->token, $this->address); |
765 | 765 | } |
766 | 766 | |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | } else { |
779 | 779 | $lead = (int) $lead; |
780 | 780 | } |
781 | - $url = '/lead/' . $lead . '/funnel'; |
|
781 | + $url = '/lead/'.$lead.'/funnel'; |
|
782 | 782 | $data = [ |
783 | 783 | 'funnel' => $newStageId, |
784 | 784 | 'options' => $options, |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | } else { |
814 | 814 | $lead = (int) $lead; |
815 | 815 | } |
816 | - $url = '/lead/' . $lead . '/owner'; |
|
816 | + $url = '/lead/'.$lead.'/owner'; |
|
817 | 817 | $data = [ |
818 | 818 | 'owner' => $newOwnerId, |
819 | 819 | 'options' => $options, |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | } else { |
836 | 836 | $lead = (int) $lead; |
837 | 837 | } |
838 | - $url = '/lead/' . $lead . '/comments'; |
|
838 | + $url = '/lead/'.$lead.'/comments'; |
|
839 | 839 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
840 | 840 | $result = []; |
841 | 841 | foreach ($response as $commentData) { |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | } else { |
860 | 860 | $lead = (int) $lead; |
861 | 861 | } |
862 | - $url = '/lead/' . $lead . '/comment'; |
|
862 | + $url = '/lead/'.$lead.'/comment'; |
|
863 | 863 | $data = [ |
864 | 864 | 'text' => $text, |
865 | 865 | 'options' => $options, |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | } else { |
888 | 888 | $custom = (int) $custom; |
889 | 889 | } |
890 | - $url = '/lead/' . $lead . '/file'; |
|
890 | + $url = '/lead/'.$lead.'/file'; |
|
891 | 891 | $data = [ |
892 | 892 | 'name' => pathinfo($absolutePath, PATHINFO_BASENAME), |
893 | 893 | 'mime' => mime_content_type($absolutePath), |
@@ -904,11 +904,11 @@ discard block |
||
904 | 904 | */ |
905 | 905 | public function saveLeadCustom(Custom $custom, array $options = []) |
906 | 906 | { |
907 | - if (!$custom->validate() || empty($custom->getLeadId())) { |
|
907 | + if ( ! $custom->validate() || empty($custom->getLeadId())) { |
|
908 | 908 | throw new LPTrackerSDKException('Invalid custom'); |
909 | 909 | } |
910 | 910 | |
911 | - $url = '/lead/' . $custom->getLeadId() . '/custom/' . $custom->getId(); |
|
911 | + $url = '/lead/'.$custom->getLeadId().'/custom/'.$custom->getId(); |
|
912 | 912 | if ($custom->getValue() === null) { |
913 | 913 | $data = [ |
914 | 914 | 'options' => $options, |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | } else { |
972 | 972 | $project = (int) $project; |
973 | 973 | } |
974 | - $actionUrl = '/custom/' . $project . '/create'; |
|
974 | + $actionUrl = '/custom/'.$project.'/create'; |
|
975 | 975 | $response = LPTrackerRequest::sendRequest($actionUrl, $options, 'POST', $this->token, $this->address); |
976 | 976 | return new CustomField($response); |
977 | 977 | } |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | } else { |
995 | 995 | $project = (int) $project; |
996 | 996 | } |
997 | - $actionUrl = '/lead/' . $project . '/list?' . http_build_query([ |
|
997 | + $actionUrl = '/lead/'.$project.'/list?'.http_build_query([ |
|
998 | 998 | 'offset' => $offset, |
999 | 999 | 'limit' => $limit, |
1000 | 1000 | 'sort' => $sort, |