示例#1
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);
                 }
             }
         }
     }
 }