@@ -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, |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | } else { |
765 | 765 | $lead = (int) $lead; |
766 | 766 | } |
767 | - $url = '/lead/' . $lead . '/funnel'; |
|
767 | + $url = '/lead/'.$lead.'/funnel'; |
|
768 | 768 | $data = [ |
769 | 769 | 'funnel' => $newStageId, |
770 | 770 | 'options' => $options, |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | } else { |
800 | 800 | $lead = (int) $lead; |
801 | 801 | } |
802 | - $url = '/lead/' . $lead . '/owner'; |
|
802 | + $url = '/lead/'.$lead.'/owner'; |
|
803 | 803 | $data = [ |
804 | 804 | 'owner' => $newOwnerId, |
805 | 805 | 'options' => $options, |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | } else { |
822 | 822 | $lead = (int) $lead; |
823 | 823 | } |
824 | - $url = '/lead/' . $lead . '/comments'; |
|
824 | + $url = '/lead/'.$lead.'/comments'; |
|
825 | 825 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
826 | 826 | $result = []; |
827 | 827 | foreach ($response as $commentData) { |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | } else { |
846 | 846 | $lead = (int) $lead; |
847 | 847 | } |
848 | - $url = '/lead/' . $lead . '/comment'; |
|
848 | + $url = '/lead/'.$lead.'/comment'; |
|
849 | 849 | $data = [ |
850 | 850 | 'text' => $text, |
851 | 851 | 'options' => $options, |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | } else { |
874 | 874 | $custom = (int) $custom; |
875 | 875 | } |
876 | - $url = '/lead/' . $lead . '/file'; |
|
876 | + $url = '/lead/'.$lead.'/file'; |
|
877 | 877 | $data = [ |
878 | 878 | 'name' => pathinfo($absolutePath, PATHINFO_BASENAME), |
879 | 879 | 'mime' => mime_content_type($absolutePath), |
@@ -890,11 +890,11 @@ discard block |
||
890 | 890 | */ |
891 | 891 | public function saveLeadCustom(Custom $custom, array $options = []) |
892 | 892 | { |
893 | - if (!$custom->validate() || empty($custom->getLeadId())) { |
|
893 | + if ( ! $custom->validate() || empty($custom->getLeadId())) { |
|
894 | 894 | throw new LPTrackerSDKException('Invalid custom'); |
895 | 895 | } |
896 | 896 | |
897 | - $url = '/lead/' . $custom->getLeadId() . '/custom/' . $custom->getId(); |
|
897 | + $url = '/lead/'.$custom->getLeadId().'/custom/'.$custom->getId(); |
|
898 | 898 | if ($custom->getValue() === null) { |
899 | 899 | $data = [ |
900 | 900 | 'options' => $options, |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | } else { |
958 | 958 | $project = (int) $project; |
959 | 959 | } |
960 | - $actionUrl = '/custom/' . $project . '/create'; |
|
960 | + $actionUrl = '/custom/'.$project.'/create'; |
|
961 | 961 | $response = LPTrackerRequest::sendRequest($actionUrl, $options, 'POST', $this->token, $this->address); |
962 | 962 | return new CustomField($response); |
963 | 963 | } |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | } else { |
981 | 981 | $project = (int) $project; |
982 | 982 | } |
983 | - $actionUrl = '/lead/' . $project . '/list?' . http_build_query([ |
|
983 | + $actionUrl = '/lead/'.$project.'/list?'.http_build_query([ |
|
984 | 984 | 'offset' => $offset, |
985 | 985 | 'limit' => $limit, |
986 | 986 | 'sort' => $sort, |
@@ -91,7 +91,7 @@ |
||
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; |