|
@@ 440-450 (lines=11) @@
|
| 437 |
|
$this->methodBody->add('$request = $beforeSendEvent->getRequest();'); |
| 438 |
|
$this->methodBody->add('try {'); |
| 439 |
|
|
| 440 |
|
if ($this->callback !== null && $this->callbackOptional) { |
| 441 |
|
$this->methodBody->add('if (%s !== null) {', $this->callback); |
| 442 |
|
$this->methodBody->add('$response = $this->client->sendAsync($request, %s);', $this->callback); |
| 443 |
|
$this->methodBody->add('} else {'); |
| 444 |
|
$this->methodBody->add('$response = $this->client->send($request);'); |
| 445 |
|
$this->methodBody->add('}'); |
| 446 |
|
} elseif ($this->callback !== null && !$this->callbackOptional) { |
| 447 |
|
$this->methodBody->add('$response = $this->client->sendAsync($request, %s);', $this->callback); |
| 448 |
|
} else { |
| 449 |
|
$this->methodBody->add('$response = $this->client->send($request);'); |
| 450 |
|
} |
| 451 |
|
|
| 452 |
|
$this->methodBody->add('} catch (\Exception $exception) {'); |
| 453 |
|
$this->methodBody->add('$apiExceptionEvent = new \Tebru\Retrofit\Event\ApiExceptionEvent($exception, $request);'); |
|
@@ 468-480 (lines=13) @@
|
| 465 |
|
*/ |
| 466 |
|
private function createReturns() |
| 467 |
|
{ |
| 468 |
|
if ($this->callback !== null && $this->callbackOptional) { |
| 469 |
|
$this->methodBody->add('if (%s !== null) {', $this->callback); |
| 470 |
|
$this->methodBody->add('$returnEvent = new \Tebru\Retrofit\Event\ReturnEvent(null);'); |
| 471 |
|
$this->methodBody->add('$this->eventDispatcher->dispatch("retrofit.return", $returnEvent);'); |
| 472 |
|
$this->methodBody->add('return $returnEvent->getReturn();'); |
| 473 |
|
$this->methodBody->add('}'); |
| 474 |
|
} elseif ($this->callback !== null && !$this->callbackOptional) { |
| 475 |
|
$this->methodBody->add('$returnEvent = new \Tebru\Retrofit\Event\ReturnEvent(null);'); |
| 476 |
|
$this->methodBody->add('$this->eventDispatcher->dispatch("retrofit.return", $returnEvent);'); |
| 477 |
|
$this->methodBody->add('return $returnEvent->getReturn();'); |
| 478 |
|
|
| 479 |
|
return; |
| 480 |
|
} |
| 481 |
|
|
| 482 |
|
$matches = []; |
| 483 |
|
$returnType = $this->returnType; |