| @@ 206-225 (lines=20) @@ | ||
| 203 | * @return Contact |
|
| 204 | * @throws LPTrackerSDKException |
|
| 205 | */ |
|
| 206 | public function getContact($contact) |
|
| 207 | { |
|
| 208 | if ($contact instanceof Contact) { |
|
| 209 | $contact = $contact->getId(); |
|
| 210 | } else { |
|
| 211 | $contact = intval($contact); |
|
| 212 | } |
|
| 213 | ||
| 214 | if ($contact <= 0) { |
|
| 215 | throw new LPTrackerSDKException('Invalid contact ID'); |
|
| 216 | } |
|
| 217 | ||
| 218 | $url = '/contact/'.$contact; |
|
| 219 | ||
| 220 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 221 | ||
| 222 | $resultContact = new Contact($response); |
|
| 223 | ||
| 224 | return $resultContact; |
|
| 225 | } |
|
| 226 | ||
| 227 | ||
| 228 | /** |
|
| @@ 446-465 (lines=20) @@ | ||
| 443 | * @return Lead |
|
| 444 | * @throws LPTrackerSDKException |
|
| 445 | */ |
|
| 446 | public function getLead($lead) |
|
| 447 | { |
|
| 448 | if ($lead instanceof Lead) { |
|
| 449 | $lead = $lead->getId(); |
|
| 450 | } else { |
|
| 451 | $lead = intval($lead); |
|
| 452 | } |
|
| 453 | ||
| 454 | if ($lead <= 0) { |
|
| 455 | throw new LPTrackerSDKException('Invalid lead ID'); |
|
| 456 | } |
|
| 457 | ||
| 458 | $url = '/lead/'.$lead; |
|
| 459 | ||
| 460 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 461 | ||
| 462 | $resultLead = new Lead($response); |
|
| 463 | ||
| 464 | return $resultLead; |
|
| 465 | } |
|
| 466 | ||
| 467 | ||
| 468 | /** |
|