headerName = $headerName; $this->reactOnPath = $reactOnPath; $this->translateGetParam = $translateGetParam; } public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { if ($this->reactOnPath !== null && $request->getUri()->getPath() === $this->reactOnPath) { $request = $request->withAddedHeader( $this->headerName, $request->getQueryParams()[$this->translateGetParam] ?? '' ); } return $handler->handle($request); } }