| Conditions | 8 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 8 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 59 | 17 | public function status(PayloadInterface $payload) |
|
| 60 | { |
||
| 61 | 17 | $status = $payload->getStatus(); |
|
| 62 | |||
| 63 | // Legacy logic |
||
| 64 | // @todo Remove this in 2.0 |
||
| 65 | 17 | if (is_int($status)) { |
|
| 66 | 6 | if ($status >= PayloadInterface::OK && $status < PayloadInterface::ERROR) { |
|
|
2 ignored issues
–
show
|
|||
| 67 | 3 | return 200; |
|
| 68 | } |
||
| 69 | 3 | if ($status >= PayloadInterface::ERROR && $status < PayloadInterface::INVALID) { |
|
|
2 ignored issues
–
show
|
|||
| 70 | 1 | return 500; |
|
| 71 | } |
||
| 72 | 2 | if ($status >= PayloadInterface::INVALID && $status < PayloadInterface::UNKNOWN) { |
|
|
2 ignored issues
–
show
|
|||
| 73 | 1 | return 400; |
|
| 74 | } |
||
| 75 | 1 | return 520; |
|
| 76 | } |
||
| 77 | |||
| 78 | 11 | return $this->http_status->getStatusCode($status); |
|
| 79 | } |
||
| 80 | } |
||
| 81 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.