@@ -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)); |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | $data = array_merge($data, $options); |
587 | 587 | if (isset($leadData['view_id'])) { |
588 | 588 | $data['view_id'] = (int) $leadData['view_id']; |
589 | - } elseif (!empty($lead->getView()) && !empty($lead->getView()->getId())) { |
|
589 | + } elseif ( ! empty($lead->getView()) && ! empty($lead->getView()->getId())) { |
|
590 | 590 | $data['view_id'] = $lead->getView()->getId(); |
591 | 591 | } |
592 | 592 | $response = LPTrackerRequest::sendRequest('/lead', $data, 'POST', $this->token, $this->address); |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | throw new LPTrackerSDKException('Invalid lead ID'); |
610 | 610 | } |
611 | 611 | |
612 | - $url = '/lead/' . $lead; |
|
612 | + $url = '/lead/'.$lead; |
|
613 | 613 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
614 | 614 | return new Lead($response); |
615 | 615 | } |
@@ -638,12 +638,12 @@ discard block |
||
638 | 638 | if ($custom <= 0) { |
639 | 639 | throw new LPTrackerSDKException('Invalid custom ID'); |
640 | 640 | } |
641 | - $file = (int)$file; |
|
641 | + $file = (int) $file; |
|
642 | 642 | if ($file <= 0) { |
643 | 643 | throw new LPTrackerSDKException('Invalid file ID'); |
644 | 644 | } |
645 | 645 | |
646 | - $url = '/lead/' . $lead . '/custom/' . $custom . '/file/' . $file; |
|
646 | + $url = '/lead/'.$lead.'/custom/'.$custom.'/file/'.$file; |
|
647 | 647 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
648 | 648 | return new LeadFile($response); |
649 | 649 | } |
@@ -655,12 +655,12 @@ discard block |
||
655 | 655 | */ |
656 | 656 | public function saveLead(Lead $lead) |
657 | 657 | { |
658 | - if (!$lead->validate()) { |
|
658 | + if ( ! $lead->validate()) { |
|
659 | 659 | throw new LPTrackerSDKException('Invalid lead'); |
660 | 660 | } |
661 | 661 | |
662 | 662 | if ($lead->getId() > 0) { |
663 | - $url = '/lead/' . $lead->getId(); |
|
663 | + $url = '/lead/'.$lead->getId(); |
|
664 | 664 | $response = LPTrackerRequest::sendRequest($url, $lead->toArray(true), 'PUT', $this->token, $this->address); |
665 | 665 | } else { |
666 | 666 | $response = LPTrackerRequest::sendRequest( |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | throw new LPTrackerSDKException('Invalid lead ID'); |
725 | 725 | } |
726 | 726 | |
727 | - $url = '/lead/' . $lead . '/payment'; |
|
727 | + $url = '/lead/'.$lead.'/payment'; |
|
728 | 728 | $data = [ |
729 | 729 | 'category' => $category, |
730 | 730 | 'purpose' => $purpose, |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | } else { |
759 | 759 | $lead = (int) $lead; |
760 | 760 | } |
761 | - $url = '/lead/' . $lead . '/call'; |
|
761 | + $url = '/lead/'.$lead.'/call'; |
|
762 | 762 | LPTrackerRequest::sendRequest($url, [], 'POST', $this->token, $this->address); |
763 | 763 | } |
764 | 764 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | } else { |
777 | 777 | $lead = (int) $lead; |
778 | 778 | } |
779 | - $url = '/lead/' . $lead . '/funnel'; |
|
779 | + $url = '/lead/'.$lead.'/funnel'; |
|
780 | 780 | $data = [ |
781 | 781 | 'funnel' => $newStageId, |
782 | 782 | 'options' => $options, |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | } else { |
812 | 812 | $lead = (int) $lead; |
813 | 813 | } |
814 | - $url = '/lead/' . $lead . '/owner'; |
|
814 | + $url = '/lead/'.$lead.'/owner'; |
|
815 | 815 | $data = [ |
816 | 816 | 'owner' => $newOwnerId, |
817 | 817 | 'options' => $options, |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | } else { |
834 | 834 | $lead = (int) $lead; |
835 | 835 | } |
836 | - $url = '/lead/' . $lead . '/comments'; |
|
836 | + $url = '/lead/'.$lead.'/comments'; |
|
837 | 837 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
838 | 838 | $result = []; |
839 | 839 | foreach ($response as $commentData) { |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | } else { |
858 | 858 | $lead = (int) $lead; |
859 | 859 | } |
860 | - $url = '/lead/' . $lead . '/comment'; |
|
860 | + $url = '/lead/'.$lead.'/comment'; |
|
861 | 861 | $data = [ |
862 | 862 | 'text' => $text, |
863 | 863 | 'options' => $options, |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | } else { |
886 | 886 | $custom = (int) $custom; |
887 | 887 | } |
888 | - $url = '/lead/' . $lead . '/file'; |
|
888 | + $url = '/lead/'.$lead.'/file'; |
|
889 | 889 | $data = [ |
890 | 890 | 'name' => pathinfo($absolutePath, PATHINFO_BASENAME), |
891 | 891 | 'mime' => mime_content_type($absolutePath), |
@@ -902,11 +902,11 @@ discard block |
||
902 | 902 | */ |
903 | 903 | public function saveLeadCustom(Custom $custom, array $options = []) |
904 | 904 | { |
905 | - if (!$custom->validate() || empty($custom->getLeadId())) { |
|
905 | + if ( ! $custom->validate() || empty($custom->getLeadId())) { |
|
906 | 906 | throw new LPTrackerSDKException('Invalid custom'); |
907 | 907 | } |
908 | 908 | |
909 | - $url = '/lead/' . $custom->getLeadId() . '/custom/' . $custom->getId(); |
|
909 | + $url = '/lead/'.$custom->getLeadId().'/custom/'.$custom->getId(); |
|
910 | 910 | if ($custom->getValue() === null) { |
911 | 911 | $data = [ |
912 | 912 | 'options' => $options, |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | } else { |
970 | 970 | $project = (int) $project; |
971 | 971 | } |
972 | - $actionUrl = '/custom/' . $project . '/create'; |
|
972 | + $actionUrl = '/custom/'.$project.'/create'; |
|
973 | 973 | $response = LPTrackerRequest::sendRequest($actionUrl, $options, 'POST', $this->token, $this->address); |
974 | 974 | return new CustomField($response); |
975 | 975 | } |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | } else { |
993 | 993 | $project = (int) $project; |
994 | 994 | } |
995 | - $actionUrl = '/lead/' . $project . '/list?' . http_build_query([ |
|
995 | + $actionUrl = '/lead/'.$project.'/list?'.http_build_query([ |
|
996 | 996 | 'offset' => $offset, |
997 | 997 | 'limit' => $limit, |
998 | 998 | 'sort' => $sort, |