Conditions | 4 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function handle() |
||
22 | { |
||
23 | if (!$this->annotations->exists(Returns::NAME)) { |
||
24 | return null; |
||
25 | } |
||
26 | |||
27 | /** @var Returns $returnAnnotation */ |
||
28 | $returnAnnotation = $this->annotations->get(Returns::NAME); |
||
29 | $return = $returnAnnotation->getReturn(); |
||
30 | $this->methodBodyBuilder->setReturnType($return); |
||
31 | |||
32 | if ('Response' === $return) { |
||
33 | if (!$this->annotations->exists(ResponseType::NAME)) { |
||
34 | throw new RetrofitException('When using a Response return type, an @ResponseType must also be set.'); |
||
35 | } |
||
36 | |||
37 | /** @var ResponseType $responseAnnotation */ |
||
38 | $responseAnnotation = $this->annotations->get(ResponseType::NAME); |
||
39 | $responseType = $responseAnnotation->getType(); |
||
40 | |||
41 | $this->methodBodyBuilder->setResponseType($responseType); |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 |