| @@ 100-118 (lines=19) @@ | ||
| 97 | * |
|
| 98 | * @return Custom[] |
|
| 99 | */ |
|
| 100 | public function getProjectCustoms($project) |
|
| 101 | { |
|
| 102 | if ($project instanceof Project) { |
|
| 103 | $project = $project->getId(); |
|
| 104 | } else { |
|
| 105 | $project = intval($project); |
|
| 106 | } |
|
| 107 | ||
| 108 | $url = '/project/'.$project.'/customs'; |
|
| 109 | ||
| 110 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 111 | ||
| 112 | $result = []; |
|
| 113 | foreach ($response as $customData) { |
|
| 114 | $result[] = new Custom($customData); |
|
| 115 | } |
|
| 116 | ||
| 117 | return $result; |
|
| 118 | } |
|
| 119 | ||
| 120 | ||
| 121 | /** |
|
| @@ 295-313 (lines=19) @@ | ||
| 292 | * |
|
| 293 | * @return Comment[] |
|
| 294 | */ |
|
| 295 | public function getLeadComments($lead) |
|
| 296 | { |
|
| 297 | if ($lead instanceof Lead) { |
|
| 298 | $lead = $lead->getId(); |
|
| 299 | } else { |
|
| 300 | $lead = intval($lead); |
|
| 301 | } |
|
| 302 | ||
| 303 | $url = '/lead/'.$lead.'/comments'; |
|
| 304 | ||
| 305 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 306 | ||
| 307 | $result = []; |
|
| 308 | foreach ($response as $commentData) { |
|
| 309 | $result[] = new Comment($commentData); |
|
| 310 | } |
|
| 311 | ||
| 312 | return $result; |
|
| 313 | } |
|
| 314 | ||
| 315 | ||
| 316 | /** |
|
| @@ 322-341 (lines=20) @@ | ||
| 319 | * |
|
| 320 | * @return Comment |
|
| 321 | */ |
|
| 322 | public function addCommentToLead($lead, $text) |
|
| 323 | { |
|
| 324 | if ($lead instanceof Lead) { |
|
| 325 | $lead = $lead->getId(); |
|
| 326 | } else { |
|
| 327 | $lead = intval($lead); |
|
| 328 | } |
|
| 329 | ||
| 330 | $url = '/lead/'.$lead.'/comment'; |
|
| 331 | ||
| 332 | $data = [ |
|
| 333 | 'text' => $text |
|
| 334 | ]; |
|
| 335 | ||
| 336 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 337 | ||
| 338 | $comment = new Comment($response); |
|
| 339 | ||
| 340 | return $comment; |
|
| 341 | } |
|
| 342 | ||
| 343 | ||
| 344 | /** |
|