protected function getCacheControlDirective(ResponseInterface $response, string $name)
    {
        foreach ($response->getHeader('Cache-Control') as $header) {
            if (preg_match(sprintf('|%s=?([0-9]+)?|i', $name), $header, $matches)) {
                // return the value for $name if it exists
                if (isset($matches[1])) {
                    return $matches[1];
                }

                return true;
            }
        }

        return false;
    }