@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } else { |
| 88 | 88 | $project = (int) $project; |
| 89 | 89 | } |
| 90 | - $url = '/project/' . $project; |
|
| 90 | + $url = '/project/'.$project; |
|
| 91 | 91 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 92 | 92 | return new Project($response); |
| 93 | 93 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } else { |
| 106 | 106 | $project = (int) $project; |
| 107 | 107 | } |
| 108 | - $url = '/project/' . $project . '/customs'; |
|
| 108 | + $url = '/project/'.$project.'/customs'; |
|
| 109 | 109 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 110 | 110 | $result = []; |
| 111 | 111 | foreach ($response as $customData) { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } else { |
| 128 | 128 | $project = (int) $project; |
| 129 | 129 | } |
| 130 | - $url = '/project/' . $project . '/fields'; |
|
| 130 | + $url = '/project/'.$project.'/fields'; |
|
| 131 | 131 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 132 | 132 | $result = []; |
| 133 | 133 | foreach ($response as $customData) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } else { |
| 150 | 150 | $project = (int) $project; |
| 151 | 151 | } |
| 152 | - $url = '/project/' . $project . '/callback-url'; |
|
| 152 | + $url = '/project/'.$project.'/callback-url'; |
|
| 153 | 153 | LPTrackerRequest::sendRequest($url, ['url' => $callbackUrl], 'PUT', $this->token, $this->address); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | throw new LPTrackerSDKException('Invalid contact ID'); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - $url = '/contact/' . $contact; |
|
| 213 | + $url = '/contact/'.$contact; |
|
| 214 | 214 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 215 | 215 | return new Contact($response); |
| 216 | 216 | } |
@@ -222,12 +222,12 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function saveContact(Contact $contact) |
| 224 | 224 | { |
| 225 | - if (!$contact->validate()) { |
|
| 225 | + if ( ! $contact->validate()) { |
|
| 226 | 226 | throw new LPTrackerSDKException('Invalid contact'); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $data = $contact->toArray(); |
| 230 | - if (!empty($data['fields'])) { |
|
| 230 | + if ( ! empty($data['fields'])) { |
|
| 231 | 231 | $fields = []; |
| 232 | 232 | foreach ($data['fields'] as $field) { |
| 233 | 233 | $fields[$field['id']] = $field['value']; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $data['fields'] = $fields; |
| 236 | 236 | } |
| 237 | 237 | if ($contact->getId() > 0) { |
| 238 | - $url = '/contact/' . $contact->getId(); |
|
| 238 | + $url = '/contact/'.$contact->getId(); |
|
| 239 | 239 | $response = LPTrackerRequest::sendRequest($url, $contact->toArray(), 'PUT', $this->token, $this->address); |
| 240 | 240 | } else { |
| 241 | 241 | $response = LPTrackerRequest::sendRequest( |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | if (isset($searchOptions['phone'])) { |
| 316 | 316 | $data['phone'] = $searchOptions['phone']; |
| 317 | 317 | } |
| 318 | - $url = '/contact/search?' . http_build_query($data); |
|
| 318 | + $url = '/contact/search?'.http_build_query($data); |
|
| 319 | 319 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 320 | 320 | $result = []; |
| 321 | 321 | foreach ($response as $contactData) { |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | throw new LPTrackerSDKException('Invalid contact id'); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $url = '/contact/' . $contact . '/leads'; |
|
| 343 | + $url = '/contact/'.$contact.'/leads'; |
|
| 344 | 344 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 345 | 345 | $result = []; |
| 346 | 346 | foreach ($response as $leadData) { |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | } else { |
| 370 | 370 | $field = (int) $field; |
| 371 | 371 | } |
| 372 | - $url = '/contact/' . $contact . '/field/' . $field; |
|
| 372 | + $url = '/contact/'.$contact.'/field/'.$field; |
|
| 373 | 373 | $data = [ |
| 374 | 374 | 'value' => $newValue, |
| 375 | 375 | ]; |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $viewData['project_id'] = (int) $project; |
| 392 | 392 | } |
| 393 | 393 | $view = new View($viewData); |
| 394 | - if (!$view->validate()) { |
|
| 394 | + if ( ! $view->validate()) { |
|
| 395 | 395 | throw new LPTrackerSDKException('Invalid view data'); |
| 396 | 396 | } |
| 397 | 397 | |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | throw new LPTrackerSDKException('Invalid view ID'); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - $url = '/view/' . $view; |
|
| 419 | + $url = '/view/'.$view; |
|
| 420 | 420 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 421 | 421 | return new View($response); |
| 422 | 422 | } |
@@ -428,12 +428,12 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | public function saveView(View $view) |
| 430 | 430 | { |
| 431 | - if (!$view->validate()) { |
|
| 431 | + if ( ! $view->validate()) { |
|
| 432 | 432 | throw new LPTrackerSDKException('Invalid view'); |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | if ($view->getId() > 0) { |
| 436 | - $url = '/view/' . $view->getId(); |
|
| 436 | + $url = '/view/'.$view->getId(); |
|
| 437 | 437 | $response = LPTrackerRequest::sendRequest($url, $view->toArray(), 'PUT', $this->token, $this->address); |
| 438 | 438 | } else { |
| 439 | 439 | $response = LPTrackerRequest::sendRequest('/view', $view->toArray(), 'POST', $this->token, $this->address); |
@@ -474,11 +474,11 @@ discard block |
||
| 474 | 474 | $leadData['contact_id'] = (int) $contact; |
| 475 | 475 | } |
| 476 | 476 | $lead = new Lead($leadData); |
| 477 | - if (!$lead->validate()) { |
|
| 477 | + if ( ! $lead->validate()) { |
|
| 478 | 478 | throw new LPTrackerSDKException('Invalid lead data'); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - if (!empty($lead->getView()) && empty($lead->getView()->getId())) { |
|
| 481 | + if ( ! empty($lead->getView()) && empty($lead->getView()->getId())) { |
|
| 482 | 482 | $contactModel = $this->getContact($contact); |
| 483 | 483 | $viewData = $lead->getView()->toArray(); |
| 484 | 484 | $lead->setView($this->createView($contactModel->getProjectId(), $viewData)); |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | } |
| 490 | 490 | if (isset($leadData['view_id'])) { |
| 491 | 491 | $data['view_id'] = (int) $leadData['view_id']; |
| 492 | - } elseif (!empty($lead->getView()) && !empty($lead->getView()->getId())) { |
|
| 492 | + } elseif ( ! empty($lead->getView()) && ! empty($lead->getView()->getId())) { |
|
| 493 | 493 | $data['view_id'] = $lead->getView()->getId(); |
| 494 | 494 | } |
| 495 | 495 | $response = LPTrackerRequest::sendRequest('/lead', $data, 'POST', $this->token, $this->address); |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | throw new LPTrackerSDKException('Invalid lead ID'); |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | - $url = '/lead/' . $lead; |
|
| 515 | + $url = '/lead/'.$lead; |
|
| 516 | 516 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 517 | 517 | return new Lead($response); |
| 518 | 518 | } |
@@ -541,12 +541,12 @@ discard block |
||
| 541 | 541 | if ($custom <= 0) { |
| 542 | 542 | throw new LPTrackerSDKException('Invalid custom ID'); |
| 543 | 543 | } |
| 544 | - $file = (int)$file; |
|
| 544 | + $file = (int) $file; |
|
| 545 | 545 | if ($file <= 0) { |
| 546 | 546 | throw new LPTrackerSDKException('Invalid file ID'); |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - $url = '/lead/' . $lead . '/custom/' . $custom . '/file/' . $file; |
|
| 549 | + $url = '/lead/'.$lead.'/custom/'.$custom.'/file/'.$file; |
|
| 550 | 550 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 551 | 551 | return new LeadFile($response); |
| 552 | 552 | } |
@@ -558,12 +558,12 @@ discard block |
||
| 558 | 558 | */ |
| 559 | 559 | public function saveLead(Lead $lead) |
| 560 | 560 | { |
| 561 | - if (!$lead->validate()) { |
|
| 561 | + if ( ! $lead->validate()) { |
|
| 562 | 562 | throw new LPTrackerSDKException('Invalid lead'); |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | if ($lead->getId() > 0) { |
| 566 | - $url = '/lead/' . $lead->getId(); |
|
| 566 | + $url = '/lead/'.$lead->getId(); |
|
| 567 | 567 | $response = LPTrackerRequest::sendRequest($url, $lead->toArray(true), 'PUT', $this->token, $this->address); |
| 568 | 568 | } else { |
| 569 | 569 | $response = LPTrackerRequest::sendRequest( |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | throw new LPTrackerSDKException('Invalid lead ID'); |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - $url = '/lead/' . $lead . '/payment'; |
|
| 630 | + $url = '/lead/'.$lead.'/payment'; |
|
| 631 | 631 | $data = [ |
| 632 | 632 | 'category' => $category, |
| 633 | 633 | 'purpose' => $purpose, |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | } else { |
| 651 | 651 | $lead = (int) $lead; |
| 652 | 652 | } |
| 653 | - $url = '/lead/' . $lead . '/funnel'; |
|
| 653 | + $url = '/lead/'.$lead.'/funnel'; |
|
| 654 | 654 | $data = [ |
| 655 | 655 | 'funnel' => $newFunnelId, |
| 656 | 656 | ]; |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | } else { |
| 672 | 672 | $lead = (int) $lead; |
| 673 | 673 | } |
| 674 | - $url = '/lead/' . $lead . '/comments'; |
|
| 674 | + $url = '/lead/'.$lead.'/comments'; |
|
| 675 | 675 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
| 676 | 676 | $result = []; |
| 677 | 677 | foreach ($response as $commentData) { |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | } else { |
| 695 | 695 | $lead = (int) $lead; |
| 696 | 696 | } |
| 697 | - $url = '/lead/' . $lead . '/comment'; |
|
| 697 | + $url = '/lead/'.$lead.'/comment'; |
|
| 698 | 698 | $data = [ |
| 699 | 699 | 'text' => $text, |
| 700 | 700 | ]; |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | } else { |
| 722 | 722 | $custom = (int) $custom; |
| 723 | 723 | } |
| 724 | - $url = '/lead/' . $lead . '/file'; |
|
| 724 | + $url = '/lead/'.$lead.'/file'; |
|
| 725 | 725 | $data = [ |
| 726 | 726 | 'name' => pathinfo($absolutePath, PATHINFO_BASENAME), |
| 727 | 727 | 'mime' => mime_content_type($absolutePath), |
@@ -738,11 +738,11 @@ discard block |
||
| 738 | 738 | */ |
| 739 | 739 | public function saveLeadCustom(Custom $custom) |
| 740 | 740 | { |
| 741 | - if (!$custom->validate() || empty($custom->getLeadId())) { |
|
| 741 | + if ( ! $custom->validate() || empty($custom->getLeadId())) { |
|
| 742 | 742 | throw new LPTrackerSDKException('Invalid custom'); |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | - $url = '/lead/' . $custom->getLeadId() . '/custom/' . $custom->getId(); |
|
| 745 | + $url = '/lead/'.$custom->getLeadId().'/custom/'.$custom->getId(); |
|
| 746 | 746 | $data = [ |
| 747 | 747 | 'value' => $custom->getValue(), |
| 748 | 748 | ]; |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | } else { |
| 795 | 795 | $project = (int) $project; |
| 796 | 796 | } |
| 797 | - $actionUrl = '/custom/' . $project . '/create'; |
|
| 797 | + $actionUrl = '/custom/'.$project.'/create'; |
|
| 798 | 798 | $response = LPTrackerRequest::sendRequest($actionUrl, $options, 'POST', $this->token, $this->address); |
| 799 | 799 | return new CustomField($response); |
| 800 | 800 | } |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | } else { |
| 818 | 818 | $project = (int) $project; |
| 819 | 819 | } |
| 820 | - $actionUrl = '/lead/' . $project . '/list?' . http_build_query([ |
|
| 820 | + $actionUrl = '/lead/'.$project.'/list?'.http_build_query([ |
|
| 821 | 821 | 'offset' => $offset, |
| 822 | 822 | 'limit' => $limit, |
| 823 | 823 | 'sort' => $sort, |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function __construct(array $fileData = []) |
| 20 | 20 | { |
| 21 | - if (!empty($fileData['id'])) { |
|
| 21 | + if ( ! empty($fileData['id'])) { |
|
| 22 | 22 | $this->id = (int) $fileData['id']; |
| 23 | 23 | } |
| 24 | - if (!empty($fileData['name'])) { |
|
| 24 | + if ( ! empty($fileData['name'])) { |
|
| 25 | 25 | $this->name = $fileData['name']; |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | public function toArray() |
| 33 | 33 | { |
| 34 | 34 | $result = []; |
| 35 | - if (!empty($this->id)) { |
|
| 35 | + if ( ! empty($this->id)) { |
|
| 36 | 36 | $result['id'] = $this->getId(); |
| 37 | 37 | } |
| 38 | - if (!empty($this->name)) { |
|
| 38 | + if ( ! empty($this->name)) { |
|
| 39 | 39 | $result['name'] = $this->getName(); |
| 40 | 40 | } |
| 41 | 41 | return $result; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | return $this->name; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function validate(){ |
|
| 60 | + public function validate() { |
|
| 61 | 61 | return true; |
| 62 | 62 | } |
| 63 | 63 | } |