| @@ 215-234 (lines=20) @@ | ||
| 212 | * @return Contact |
|
| 213 | * @throws LPTrackerSDKException |
|
| 214 | */ |
|
| 215 | public function getContact($contact) |
|
| 216 | { |
|
| 217 | if ($contact instanceof Contact) { |
|
| 218 | $contact = $contact->getId(); |
|
| 219 | } else { |
|
| 220 | $contact = intval($contact); |
|
| 221 | } |
|
| 222 | ||
| 223 | if ($contact <= 0) { |
|
| 224 | throw new LPTrackerSDKException('Invalid contact ID'); |
|
| 225 | } |
|
| 226 | ||
| 227 | $url = '/contact/'.$contact; |
|
| 228 | ||
| 229 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 230 | ||
| 231 | $resultContact = new Contact($response); |
|
| 232 | ||
| 233 | return $resultContact; |
|
| 234 | } |
|
| 235 | ||
| 236 | ||
| 237 | /** |
|
| @@ 453-472 (lines=20) @@ | ||
| 450 | * @return View |
|
| 451 | * @throws LPTrackerSDKException |
|
| 452 | */ |
|
| 453 | public function getView($view) |
|
| 454 | { |
|
| 455 | if ($view instanceof View) { |
|
| 456 | $view = $view->getId(); |
|
| 457 | } else { |
|
| 458 | $view = intval($view); |
|
| 459 | } |
|
| 460 | ||
| 461 | if ($view <= 0) { |
|
| 462 | throw new LPTrackerSDKException('Invalid view ID'); |
|
| 463 | } |
|
| 464 | ||
| 465 | $url = '/view/'.$view; |
|
| 466 | ||
| 467 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 468 | ||
| 469 | $resultView = new View($response); |
|
| 470 | ||
| 471 | return $resultView; |
|
| 472 | } |
|
| 473 | ||
| 474 | ||
| 475 | /** |
|
| @@ 562-581 (lines=20) @@ | ||
| 559 | * @return Lead |
|
| 560 | * @throws LPTrackerSDKException |
|
| 561 | */ |
|
| 562 | public function getLead($lead) |
|
| 563 | { |
|
| 564 | if ($lead instanceof Lead) { |
|
| 565 | $lead = $lead->getId(); |
|
| 566 | } else { |
|
| 567 | $lead = intval($lead); |
|
| 568 | } |
|
| 569 | ||
| 570 | if ($lead <= 0) { |
|
| 571 | throw new LPTrackerSDKException('Invalid lead ID'); |
|
| 572 | } |
|
| 573 | ||
| 574 | $url = '/lead/'.$lead; |
|
| 575 | ||
| 576 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 577 | ||
| 578 | $resultLead = new Lead($response); |
|
| 579 | ||
| 580 | return $resultLead; |
|
| 581 | } |
|
| 582 | ||
| 583 | ||
| 584 | /** |
|