@@ -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 $key => $field) { |
| 284 | 284 | if (is_array($field) && isset($field['id'], $field['value'])) { |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $data['fields'] = $fields; |
| 291 | 291 | } |
| 292 | 292 | if ($contact->getId() > 0) { |
| 293 | - $url = '/contact/' . $contact->getId(); |
|
| 293 | + $url = '/contact/'.$contact->getId(); |
|
| 294 | 294 | $response = LPTrackerRequest::sendRequest($url, $contact->toArray(), 'PUT', $this->token, $this->address); |
| 295 | 295 | } else { |
| 296 | 296 | $response = LPTrackerRequest::sendRequest('/contact', $contact->toArray(), 'POST', $this->token, $this->address); |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | if (isset($searchOptions['phone'])) { |
| 365 | 365 | $data['phone'] = $searchOptions['phone']; |
| 366 | 366 | } |
| 367 | - $url = '/contact/search?' . http_build_query($data); |
|
| 367 | + $url = '/contact/search?'.http_build_query($data); |
|
| 368 | 368 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 369 | 369 | $result = []; |
| 370 | 370 | foreach ($response as $contactData) { |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | throw new LPTrackerSDKException('Invalid contact id'); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - $url = '/contact/' . $contact . '/leads'; |
|
| 392 | + $url = '/contact/'.$contact.'/leads'; |
|
| 393 | 393 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 394 | 394 | $result = []; |
| 395 | 395 | foreach ($response as $leadData) { |
@@ -462,11 +462,11 @@ discard block |
||
| 462 | 462 | */ |
| 463 | 463 | public function saveContactField(ContactField $field) |
| 464 | 464 | { |
| 465 | - if (!$field->validate() || empty($field->getContactId())) { |
|
| 465 | + if ( ! $field->validate() || empty($field->getContactId())) { |
|
| 466 | 466 | throw new LPTrackerSDKException('Invalid field'); |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - $url = '/contact/' . $field->getContactId() . '/field/' . $field->getId(); |
|
| 469 | + $url = '/contact/'.$field->getContactId().'/field/'.$field->getId(); |
|
| 470 | 470 | if ($field->getValue() === null) { |
| 471 | 471 | LPTrackerRequest::sendRequest($url, [], 'DELETE', $this->token, $this->address); |
| 472 | 472 | $response = $field->toArray(); |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | $viewData['project_id'] = (int) $project; |
| 495 | 495 | } |
| 496 | 496 | $view = new View($viewData); |
| 497 | - if (!$view->validate()) { |
|
| 497 | + if ( ! $view->validate()) { |
|
| 498 | 498 | throw new LPTrackerSDKException('Invalid view data'); |
| 499 | 499 | } |
| 500 | 500 | |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | throw new LPTrackerSDKException('Invalid view ID'); |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | - $url = '/view/' . $view; |
|
| 522 | + $url = '/view/'.$view; |
|
| 523 | 523 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 524 | 524 | return new View($response); |
| 525 | 525 | } |
@@ -531,12 +531,12 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | public function saveView(View $view) |
| 533 | 533 | { |
| 534 | - if (!$view->validate()) { |
|
| 534 | + if ( ! $view->validate()) { |
|
| 535 | 535 | throw new LPTrackerSDKException('Invalid view'); |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | if ($view->getId() > 0) { |
| 539 | - $url = '/view/' . $view->getId(); |
|
| 539 | + $url = '/view/'.$view->getId(); |
|
| 540 | 540 | $response = LPTrackerRequest::sendRequest($url, $view->toArray(), 'PUT', $this->token, $this->address); |
| 541 | 541 | } else { |
| 542 | 542 | $response = LPTrackerRequest::sendRequest('/view', $view->toArray(), 'POST', $this->token, $this->address); |
@@ -577,11 +577,11 @@ discard block |
||
| 577 | 577 | $leadData['contact_id'] = (int) $contact; |
| 578 | 578 | } |
| 579 | 579 | $lead = new Lead($leadData); |
| 580 | - if (!$lead->validate()) { |
|
| 580 | + if ( ! $lead->validate()) { |
|
| 581 | 581 | throw new LPTrackerSDKException('Invalid lead data'); |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - if (!empty($lead->getView()) && empty($lead->getView()->getId())) { |
|
| 584 | + if ( ! empty($lead->getView()) && empty($lead->getView()->getId())) { |
|
| 585 | 585 | $contactModel = $this->getContact($contact); |
| 586 | 586 | $viewData = $lead->getView()->toArray(); |
| 587 | 587 | $lead->setView($this->createView($contactModel->getProjectId(), $viewData)); |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | $data = array_merge($data, $options); |
| 591 | 591 | if (isset($leadData['view_id'])) { |
| 592 | 592 | $data['view_id'] = (int) $leadData['view_id']; |
| 593 | - } elseif (!empty($lead->getView()) && !empty($lead->getView()->getId())) { |
|
| 593 | + } elseif ( ! empty($lead->getView()) && ! empty($lead->getView()->getId())) { |
|
| 594 | 594 | $data['view_id'] = $lead->getView()->getId(); |
| 595 | 595 | } |
| 596 | 596 | $response = LPTrackerRequest::sendRequest('/lead', $data, 'POST', $this->token, $this->address); |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | throw new LPTrackerSDKException('Invalid lead ID'); |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | - $url = '/lead/' . $lead; |
|
| 616 | + $url = '/lead/'.$lead; |
|
| 617 | 617 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 618 | 618 | return new Lead($response); |
| 619 | 619 | } |
@@ -642,12 +642,12 @@ discard block |
||
| 642 | 642 | if ($custom <= 0) { |
| 643 | 643 | throw new LPTrackerSDKException('Invalid custom ID'); |
| 644 | 644 | } |
| 645 | - $file = (int)$file; |
|
| 645 | + $file = (int) $file; |
|
| 646 | 646 | if ($file <= 0) { |
| 647 | 647 | throw new LPTrackerSDKException('Invalid file ID'); |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - $url = '/lead/' . $lead . '/custom/' . $custom . '/file/' . $file; |
|
| 650 | + $url = '/lead/'.$lead.'/custom/'.$custom.'/file/'.$file; |
|
| 651 | 651 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 652 | 652 | return new LeadFile($response); |
| 653 | 653 | } |
@@ -659,12 +659,12 @@ discard block |
||
| 659 | 659 | */ |
| 660 | 660 | public function saveLead(Lead $lead) |
| 661 | 661 | { |
| 662 | - if (!$lead->validate()) { |
|
| 662 | + if ( ! $lead->validate()) { |
|
| 663 | 663 | throw new LPTrackerSDKException('Invalid lead'); |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | if ($lead->getId() > 0) { |
| 667 | - $url = '/lead/' . $lead->getId(); |
|
| 667 | + $url = '/lead/'.$lead->getId(); |
|
| 668 | 668 | $response = LPTrackerRequest::sendRequest($url, $lead->toArray(true), 'PUT', $this->token, $this->address); |
| 669 | 669 | } else { |
| 670 | 670 | $response = LPTrackerRequest::sendRequest( |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | throw new LPTrackerSDKException('Invalid lead ID'); |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - $url = '/lead/' . $lead . '/payment'; |
|
| 731 | + $url = '/lead/'.$lead.'/payment'; |
|
| 732 | 732 | $data = [ |
| 733 | 733 | 'category' => $category, |
| 734 | 734 | 'purpose' => $purpose, |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | } else { |
| 763 | 763 | $lead = (int) $lead; |
| 764 | 764 | } |
| 765 | - $url = '/lead/' . $lead . '/call'; |
|
| 765 | + $url = '/lead/'.$lead.'/call'; |
|
| 766 | 766 | LPTrackerRequest::sendRequest($url, [], 'POST', $this->token, $this->address); |
| 767 | 767 | } |
| 768 | 768 | |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | } else { |
| 781 | 781 | $lead = (int) $lead; |
| 782 | 782 | } |
| 783 | - $url = '/lead/' . $lead . '/funnel'; |
|
| 783 | + $url = '/lead/'.$lead.'/funnel'; |
|
| 784 | 784 | $data = [ |
| 785 | 785 | 'funnel' => $newStageId, |
| 786 | 786 | 'options' => $options, |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | } else { |
| 816 | 816 | $lead = (int) $lead; |
| 817 | 817 | } |
| 818 | - $url = '/lead/' . $lead . '/owner'; |
|
| 818 | + $url = '/lead/'.$lead.'/owner'; |
|
| 819 | 819 | $data = [ |
| 820 | 820 | 'owner' => $newOwnerId, |
| 821 | 821 | 'options' => $options, |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | } else { |
| 838 | 838 | $lead = (int) $lead; |
| 839 | 839 | } |
| 840 | - $url = '/lead/' . $lead . '/comments'; |
|
| 840 | + $url = '/lead/'.$lead.'/comments'; |
|
| 841 | 841 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 842 | 842 | $result = []; |
| 843 | 843 | foreach ($response as $commentData) { |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | } else { |
| 862 | 862 | $lead = (int) $lead; |
| 863 | 863 | } |
| 864 | - $url = '/lead/' . $lead . '/comment'; |
|
| 864 | + $url = '/lead/'.$lead.'/comment'; |
|
| 865 | 865 | $data = [ |
| 866 | 866 | 'text' => $text, |
| 867 | 867 | 'options' => $options, |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | } else { |
| 890 | 890 | $custom = (int) $custom; |
| 891 | 891 | } |
| 892 | - $url = '/lead/' . $lead . '/file'; |
|
| 892 | + $url = '/lead/'.$lead.'/file'; |
|
| 893 | 893 | $data = [ |
| 894 | 894 | 'name' => pathinfo($absolutePath, PATHINFO_BASENAME), |
| 895 | 895 | 'mime' => mime_content_type($absolutePath), |
@@ -906,11 +906,11 @@ discard block |
||
| 906 | 906 | */ |
| 907 | 907 | public function saveLeadCustom(Custom $custom, array $options = []) |
| 908 | 908 | { |
| 909 | - if (!$custom->validate() || empty($custom->getLeadId())) { |
|
| 909 | + if ( ! $custom->validate() || empty($custom->getLeadId())) { |
|
| 910 | 910 | throw new LPTrackerSDKException('Invalid custom'); |
| 911 | 911 | } |
| 912 | 912 | |
| 913 | - $url = '/lead/' . $custom->getLeadId() . '/custom/' . $custom->getId(); |
|
| 913 | + $url = '/lead/'.$custom->getLeadId().'/custom/'.$custom->getId(); |
|
| 914 | 914 | if ($custom->getValue() === null) { |
| 915 | 915 | $data = [ |
| 916 | 916 | 'options' => $options, |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | } else { |
| 974 | 974 | $project = (int) $project; |
| 975 | 975 | } |
| 976 | - $actionUrl = '/custom/' . $project . '/create'; |
|
| 976 | + $actionUrl = '/custom/'.$project.'/create'; |
|
| 977 | 977 | $response = LPTrackerRequest::sendRequest($actionUrl, $options, 'POST', $this->token, $this->address); |
| 978 | 978 | return new CustomField($response); |
| 979 | 979 | } |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | } else { |
| 997 | 997 | $project = (int) $project; |
| 998 | 998 | } |
| 999 | - $actionUrl = '/lead/' . $project . '/list?' . http_build_query([ |
|
| 999 | + $actionUrl = '/lead/'.$project.'/list?'.http_build_query([ |
|
| 1000 | 1000 | 'offset' => $offset, |
| 1001 | 1001 | 'limit' => $limit, |
| 1002 | 1002 | 'sort' => $sort, |