public function isCacheable(): bool
    {
        if (! \in_array(
            $this->statusCode,
            [
                StatusCode::OK,
                StatusCode::NON_AUTHORITATIVE_INFORMATION,
                StatusCode::MULTIPLE_CHOICES,
                StatusCode::MOVED_PERMANENTLY,
                StatusCode::FOUND,
                StatusCode::NOT_FOUND,
                StatusCode::GONE,
            ],
            true
        )
        ) {
            return false;
        }

        if (
            $this->hasCacheControl('no-store')
            || $this->hasCacheControl('private')
        ) {
            return false;
        }

        return $this->isValidateable() || $this->isFresh();
    }
public function isCacheable(): bool
    {
        if (! \in_array(
            $this->statusCode,
            [
                StatusCode::OK,
                StatusCode::NON_AUTHORITATIVE_INFORMATION,
                StatusCode::MULTIPLE_CHOICES,
                StatusCode::MOVED_PERMANENTLY,
                StatusCode::FOUND,
                StatusCode::NOT_FOUND,
                StatusCode::GONE,
            ],
            true
        )
        ) {
            return false;
        }

        if (
            $this->hasCacheControl('no-store')
            || $this->hasCacheControl('private')
        ) {
            return false;
        }

        return $this->isValidateable() || $this->isFresh();
    }
public function isCacheable ( ) : bool { if ( ! \ in_array ( $ this -> statusCode , [ StatusCode :: OK , StatusCode :: NON_AUTHORITATIVE_INFORMATION , StatusCode :: MULTIPLE_CHOICES , StatusCode :: MOVED_PERMANENTLY , StatusCode :: FOUND , StatusCode :: NOT_FOUND , StatusCode :: GONE , ] , true ) ) { return false ; } if ( $ this -> hasCacheControl ( 'no-store' ) || $ this -> hasCacheControl ( 'private' ) ) { return false ; } return $ this -> isValidateable ( ) || $ this -> isFresh ( ) ; }
Returns true if the response is worth caching under any circumstance.

Responses marked "private" with an explicit Cache-Control directive are
considered uncacheable.

Responses with neither a freshness lifetime (Expires, max-age) nor cache
validator (Last-Modified, ETag) are considered uncacheable.

@throws \RuntimeException

@return bool true if the response is worth caching, false otherwise
Returns true if the response is worth caching under any circumstance .