/**
  * Import response metadata (SOAP headers) from another response.
  *
  * @param      AgaviResponse The other response to import information from.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      0.11.0
  */
 public function merge(AgaviResponse $otherResponse)
 {
     if ($otherResponse instanceof AgaviSoapResponse) {
         foreach ($otherResponse->getSoapHeaders() as $soapHeader) {
             if (!$this->hasSoapHeader($soapHeader->namespace, $soapHeader->name)) {
                 $this->addSoapHeader($soapHeader);
             }
         }
     }
 }
 /**
  * Import response metadata (nothing in this case) from another response.
  *
  * @param      AgaviResponse The other response to import information from.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      0.11.0
  */
 public function merge(AgaviResponse $otherResponse)
 {
     parent::merge($otherResponse);
 }
 /**
  * Import response metadata (headers, cookies) from another response.
  *
  * @param      AgaviResponse The other response to import information from.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      0.11.0
  */
 public function merge(AgaviResponse $otherResponse)
 {
     if ($otherResponse instanceof AgaviWebResponse) {
         foreach ($otherResponse->getHttpHeaders() as $name => $value) {
             if (!$this->hasHttpHeader($name)) {
                 $this->setHttpHeader($name, $value);
             }
         }
         foreach ($otherResponse->getCookies() as $name => $cookie) {
             if (!$this->hasCookie($name)) {
                 $this->setCookie($name, $cookie['value'], $cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']);
             }
         }
         if ($otherResponse->hasRedirect() && !$this->hasRedirect()) {
             $redirect = $otherResponse->getRedirect();
             $this->setRedirect($redirect['location'], $redirect['code']);
         }
     }
 }
 /**
  * Send the content for this response
  *
  * @author     David Zülke <*****@*****.**>
  * @since      1.0.0
  */
 protected function sendContent()
 {
     $isContentMutable = $this->isContentMutable();
     parent::sendContent();
     if ($isContentMutable && $this->getParameter('append_eol', true)) {
         echo PHP_EOL;
     }
 }
Exemple #5
0
 /**
  * Import response metadata from another response.
  *
  * @param      AgaviResponse The other response to import information from.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      0.11.0
  */
 public function merge(AgaviResponse $otherResponse)
 {
     foreach ($otherResponse->getAttributeNamespaces() as $namespace) {
         foreach ($otherResponse->getAttributes($namespace) as $name => $value) {
             if (!$this->hasAttribute($name, $namespace)) {
                 $this->setAttribute($name, $value, $namespace);
             } elseif (is_array($value)) {
                 $thisAttribute =& $this->getAttribute($name, $namespace);
                 if (is_array($thisAttribute)) {
                     $thisAttribute = array_merge($value, $thisAttribute);
                 }
             }
         }
     }
 }
 /**
  * Set the content for this Response.
  *
  * @see        AgaviResponse::setContent()
  *
  * @param      array The content to be sent in this Response.
  *
  * @return     bool Whether or not the operation was successful.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      0.11.0
  */
 public function setContent($content)
 {
     return parent::setContent((array) $content);
 }