8080 parameters: new Parameters ([new QueryParameter (key: 'q ' ), new HeaderParameter (key: 'q ' )]),
8181 provider: [self ::class, 'headerAndQueryProvider ' ]
8282)]
83+ #[GetCollection(
84+ uriTemplate: 'header_required ' ,
85+ parameters: [
86+ 'Req ' => new HeaderParameter (required: true , schema: ['type ' => 'string ' ]),
87+ ],
88+ provider: [self ::class, 'headerProvider ' ]
89+ )]
8390#[QueryParameter(key: 'everywhere ' )]
8491class WithParameter
8592{
@@ -128,7 +135,7 @@ public static function restrictAccess(): void
128135 throw new AccessDeniedHttpException ();
129136 }
130137
131- public static function headerAndQueryProvider (Operation $ operation , array $ uriVariables = [], array $ context = [])
138+ public static function headerAndQueryProvider (Operation $ operation , array $ uriVariables = [], array $ context = []): JsonResponse
132139 {
133140 $ parameters = $ operation ->getParameters ();
134141 $ values = [$ parameters ->get ('q ' , HeaderParameter::class)->getValue (), $ parameters ->get ('q ' , QueryParameter::class)->getValue ()];
@@ -155,4 +162,12 @@ public static function toInt(Parameter $parameter, array $parameters = [], array
155162
156163 return $ operation ->withParameters ($ parameters );
157164 }
165+
166+ public static function headerProvider (Operation $ operation , array $ uriVariables = [], array $ context = []): JsonResponse
167+ {
168+ $ parameters = $ operation ->getParameters ();
169+ $ values = [$ parameters ->get ('Req ' , HeaderParameter::class)->getValue ()];
170+
171+ return new JsonResponse ($ values );
172+ }
158173}
0 commit comments