Esempio n. 1
0
 /**
  * _unserializeRecurser()
  *
  * This method will be used to traverse the depths of the structure
  * as needed to *unserialize* the profile from an xmlIterator
  *
  * @param SimpleXMLIterator $xmlIterator
  * @param Zend_Tool_Project_Profile_Resource $resource
  */
 protected function _unserializeRecurser(SimpleXMLIterator $xmlIterator, Zend_Tool_Project_Profile_Resource $resource = null)
 {
     foreach ($xmlIterator as $resourceName => $resourceData) {
         $contextName = $resourceName;
         $subResource = new Zend_Tool_Project_Profile_Resource($contextName);
         $subResource->setProfile($this->_profile);
         if ($resourceAttributes = $resourceData->attributes()) {
             $attributes = array();
             foreach ($resourceAttributes as $attrName => $attrValue) {
                 $attributes[$attrName] = (string) $attrValue;
             }
             $subResource->setAttributes($attributes);
         }
         if ($resource) {
             $resource->append($subResource, false);
         } else {
             $this->_profile->append($subResource);
         }
         if ($this->_contextRepository->isOverwritableContext($contextName) == false) {
             $subResource->initializeContext();
         }
         if ($xmlIterator->hasChildren()) {
             self::_unserializeRecurser($xmlIterator->getChildren(), $subResource);
         }
     }
 }