Conditions | 5 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | 5 | public function __invoke(Request $request, Response $response, Application $app) |
|
|
|||
13 | { |
||
14 | 5 | if ($app->offsetExists("json-schema.describedBy") && !$response->isEmpty()) { |
|
15 | 3 | if ($app["json-schema.correlationMechanism"] === "profile") { |
|
16 | 1 | $contentType = $response->headers->get("Content-Type"); |
|
17 | 1 | $response->headers->set("Content-Type", "$contentType; profile=\"{$app["json-schema.describedBy"]}\""); |
|
18 | 3 | } elseif ($app["json-schema.correlationMechanism"] === "link") { |
|
19 | 1 | $response->headers->set("Link", "<{$app["json-schema.describedBy"]}>; rel=\"describedBy\"", false); |
|
20 | 1 | } else { |
|
21 | 1 | $errorMessage = "json-schema.correlationMechanism must be either \"profile\" or \"link\""; |
|
22 | 1 | throw new ServiceUnavailableHttpException(null, $errorMessage); |
|
23 | } |
||
24 | 2 | } |
|
25 | 4 | } |
|
26 | } |
||
27 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.