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