| Conditions | 1 |
| Paths | 1 |
| Total Lines | 31 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 21 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 2 | public function defaultAction(Request $request): Response |
|
| 37 | { |
||
| 38 | 2 | $definition = $request->attributes->get('_innmind_resource_definition'); |
|
| 39 | 2 | $request = $request->attributes->get('_innmind_request'); |
|
| 40 | 2 | $format = $this->format->acceptable($request); |
|
| 41 | 2 | $mediaType = $format->preferredMediaType(); |
|
| 42 | |||
| 43 | 2 | return new Response\Response( |
|
| 44 | 2 | $code = new StatusCode(StatusCode::codes()->get('OK')), |
|
| 45 | 2 | new ReasonPhrase(ReasonPhrase::defaults()->get($code->value())), |
|
| 46 | 2 | $request->protocolVersion(), |
|
| 47 | 2 | new Headers( |
|
| 48 | 2 | (new Map('string', Header::class)) |
|
| 49 | 2 | ->put( |
|
| 50 | 2 | 'Content-Type', |
|
| 51 | 2 | new ContentType( |
|
| 52 | 2 | new ContentTypeValue( |
|
| 53 | 2 | $mediaType->topLevel(), |
|
| 54 | 2 | $mediaType->subType() |
|
| 55 | ) |
||
| 56 | ) |
||
| 57 | ) |
||
| 58 | ), |
||
| 59 | 2 | new StringStream( |
|
| 60 | 2 | $this->serializer->serialize( |
|
| 61 | 2 | $definition, |
|
| 62 | 2 | $format->name() |
|
| 63 | ) |
||
| 64 | ) |
||
| 65 | ); |
||
| 66 | } |
||
| 67 | } |
||
| 68 |