src/Service/ResponseConfigurator.php
protected function setPrivateCache(Response $response, Request $request)
    {
        if (
            !$response->headers->hasCacheControlDirective('public') ||
            $response->headers->hasCacheControlDirective('private')
        ) {
            $response->setPublic();
            foreach ($this->private_headers as $private_header) {
                if ($request->headers->has($private_header)) {
                    $response->setPrivate();
                    break;
                }
            }
        }

        return $this;
    }
protected function setPrivateCache(Response $response, Request $request)
    {
        if (
            !$response->headers->hasCacheControlDirective('public') ||
            $response->headers->hasCacheControlDirective('private')
        ) {
            $response->setPublic();
            foreach ($this->private_headers as $private_header) {
                if ($request->headers->has($private_header)) {
                    $response->setPrivate();
                    break;
                }
            }
        }

        return $this;
    }
@param Response $response
@param Request $request

@return ResponseConfigurator