public function getMaxAge(): int
    {
        if ($this->hasCacheControl('s-maxage')) {
            return $this->getCacheControl('s-maxage');
        }

        if ($this->hasCacheControl('max-age')) {
            return $this->getCacheControl('max-age');
        }

        if (null !== $this->getExpires()) {
            return date('U', strtotime($this->getExpires())) - date(
                    'U',
                    strtotime(
                        $this->getDateHeader()
                    )
                );
        }

        return 0;
    }
public function getMaxAge(): int
    {
        if ($this->hasCacheControl('s-maxage')) {
            return $this->getCacheControl('s-maxage');
        }

        if ($this->hasCacheControl('max-age')) {
            return $this->getCacheControl('max-age');
        }

        if (null !== $this->getExpires()) {
            return date('U', strtotime($this->getExpires())) - date(
                    'U',
                    strtotime(
                        $this->getDateHeader()
                    )
                );
        }

        return 0;
    }
public function getMaxAge ( ) : int { if ( $ this -> hasCacheControl ( 's-maxage' ) ) { return $ this -> getCacheControl ( 's-maxage' ) ; } if ( $ this -> hasCacheControl ( 'max-age' ) ) { return $ this -> getCacheControl ( 'max-age' ) ; } if ( null !== $ this -> getExpires ( ) ) { return date ( 'U' , strtotime ( $ this -> getExpires ( ) ) ) - date ( 'U' , strtotime ( $ this -> getDateHeader ( ) ) ) ; } return 0 ; }
Returns the number of seconds after the time specified in the response's
Date header when the response should no longer be considered fresh.

First, it checks for a s-maxage directive, then a max-age directive, and
then it falls back on an expires header. It returns null when no maximum
age can be established.

@throws \RuntimeException

@return int Number of seconds
Returns the number of seconds after the time specified in the response s Date header when the response should no longer be considered fresh .