Beispiel #1
0
 /**
  * Sets the shared max age cache control directive
  *
  * This will make your response public
  * @param boolean $flag Set to false to unset the directive, true or any value sets it
  * @return null
  * @see setIsPublic()
  */
 public function setSharedMaxAge($seconds = null)
 {
     if ($seconds === null) {
         $this->headers->removeCacheControlDirective(HeaderContainer::CACHE_CONTROL_SHARED_MAX_AGE);
         return;
     }
     if (!Number::isNumeric($seconds, Number::NOT_NEGATIVE | Number::NOT_FLOAT)) {
         throw new ZiboException('The max age should be a unsigned integer');
     }
     $this->headers->addCacheControlDirective(HeaderContainer::CACHE_CONTROL_SHARED_MAX_AGE, $seconds);
     $this->setIsPublic();
 }