@@ 446-459 (lines=14) @@ | ||
443 | * |
|
444 | * @return SMSAResponse |
|
445 | */ |
|
446 | protected function successResponse($type, $payload, $data): SMSAResponse |
|
447 | { |
|
448 | $response = new SMSAResponse( |
|
449 | true, |
|
450 | $data, |
|
451 | null, |
|
452 | $type, |
|
453 | $payload, |
|
454 | $this->service->getLastRequest(true), |
|
455 | $this->service->getLastResponse(true) |
|
456 | ); |
|
457 | ||
458 | return $response; |
|
459 | } |
|
460 | ||
461 | /** |
|
462 | * Send a Response with failed request. |
|
@@ 504-521 (lines=18) @@ | ||
501 | * |
|
502 | * @return SMSAResponse |
|
503 | */ |
|
504 | protected function failedResponse($type, $payload, $error) |
|
505 | { |
|
506 | $response = new SMSAResponse( |
|
507 | false, |
|
508 | null, |
|
509 | $error, |
|
510 | $type, |
|
511 | $payload, |
|
512 | $this->service->getLastRequest(true), |
|
513 | $this->service->getLastResponse(true) |
|
514 | ); |
|
515 | ||
516 | if ($this->shouldUseExceptions()) { |
|
517 | throw new FailedResponse($response, $error); |
|
518 | } |
|
519 | ||
520 | return $response; |
|
521 | } |
|
522 | ||
523 | protected function shouldUseExceptions() |
|
524 | { |