| Conditions | 2 |
| Paths | 1 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 6 | public function __invoke($schema) |
|
| 20 | { |
||
| 21 | 6 | $resource = $this->app["controllers_factory"]; |
|
| 22 | |||
| 23 | 6 | $resource->before(function (Request $request, Application $app) use ($schema) { |
|
| 24 | 6 | $app["json-schema.schema-store"]->add($schema, $app["resourceful.schemas"]->fetch($schema)); |
|
| 25 | 6 | }); |
|
| 26 | |||
| 27 | 6 | $resource->after(function (Request $request, Response $response, Application $app) use ($schema) { |
|
| 28 | 6 | if ($response->isSuccessful()) { |
|
| 29 | 5 | $app["json-schema.describedBy"] = $schema; |
|
| 30 | } |
||
| 31 | 6 | }); |
|
| 32 | |||
| 33 | return $resource; |
||
| 34 | } |
||
| 35 | } |
||
| 36 |