protected function getDestinationPath($tag, $destinationBaseFolder = '')
 {
     $destinationPath = $this->destinationBasePath;
     $elementShortPropertyName = 'element-short';
     $elementShort = $this->composer->extra->{$elementShortPropertyName};
     $attributes = $this->manifest->attributes();
     if (!empty($destinationBaseFolder)) {
         $destinationPath .= '/' . $destinationBaseFolder;
     }
     if ($destinationBaseFolder !== 'media') {
         // Append folders to the path according to the extension type
         $type = (string) $attributes['type'];
         switch ($type) {
             case 'component':
                 $destinationPath .= "/components/com_{$elementShort}";
                 break;
             case 'plugin':
                 $group = (string) $attributes['group'];
                 $destinationPath .= "/plugins/{$group}/{$elementShort}";
                 break;
             case 'module':
                 $destinationPath .= "/modules/mod_{$elementShort}";
             case 'template':
                 $destinationPath .= "/templates/{$elementShort}";
         }
     }
     $subDestinationFolder = (string) $attributes['destination'];
     if (!empty($subDestinationFolder)) {
         $destinationPath .= '/' . $subDestinationFolder;
     }
     return $destinationPath;
 }
Пример #2
0
 /**
  * Returns a constructor argument definition.
  *
  * @param SimpleXML $simpleXmlArg Argument node.
  *
  * @throws BeanFactoryException
  * @return BeanConstructorArgumentDefinition
  */
 private function _loadConstructorArg($simpleXmlArg)
 {
     if (isset($simpleXmlArg->ref)) {
         $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_BEAN;
         $argValue = (string) $simpleXmlArg->ref->attributes()->bean;
     } else {
         if (isset($simpleXmlArg->bean)) {
             $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_BEAN;
             $name = BeanDefinition::generateName('Bean');
             $argValue = $name;
             $simpleXmlArg->bean->addAttribute('id', $name);
         } else {
             if (isset($simpleXmlArg->null)) {
                 $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_VALUE;
                 $argValue = null;
             } else {
                 if (isset($simpleXmlArg->false)) {
                     $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_VALUE;
                     $argValue = false;
                 } else {
                     if (isset($simpleXmlArg->true)) {
                         $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_VALUE;
                         $argValue = true;
                     } else {
                         if (isset($simpleXmlArg->array)) {
                             $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_ARRAY;
                             $argValue = array();
                             foreach ($simpleXmlArg->array->entry as $arrayEntry) {
                                 $key = (string) $arrayEntry->attributes()->key;
                                 $argValue[$key] = $this->_loadConstructorArg($arrayEntry);
                             }
                         } else {
                             if (isset($simpleXmlArg->eval)) {
                                 $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_CODE;
                                 $argValue = (string) $simpleXmlArg->eval;
                             } else {
                                 $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_VALUE;
                                 $argValue = (string) $simpleXmlArg->value;
                             }
                         }
                     }
                 }
             }
         }
     }
     if (isset($simpleXmlArg->attributes()->name)) {
         $argName = (string) $simpleXmlArg->attributes()->name;
     } else {
         $argName = false;
     }
     return new BeanConstructorArgumentDefinition($argType, $argValue, $argName);
 }
 /**
  * Parses an entity entry from given SimpleXML object.
  * 
  * @param \SimpleXML $result The SimpleXML object representing the entity.
  * 
  * @return \WindowsAzure\Table\Models\Entity
  */
 private function _parseOneEntity($result)
 {
     $prefix = $this->_dataServicesMetadataPrefix;
     $prop = $result->content->xpath(".//{$prefix}:properties");
     $prop = $prop[0]->children($this->_dataServicesNamespaceName);
     $entity = new Entity();
     // Set ETag
     $etag = $result->attributes($this->_dataServicesMetadataNamespaceName);
     $etag = $etag[Resources::ETAG];
     $entity->setETag((string) $etag);
     foreach ($prop as $key => $value) {
         $attributes = $value->attributes($this->_dataServicesMetadataNamespaceName);
         $type = $attributes['type'];
         $isnull = $attributes['null'];
         $value = EdmType::unserializeQueryValue((string) $type, $value);
         $entity->addProperty((string) $key, is_null($type) ? null : (string) $type, $isnull ? null : $value);
     }
     return $entity;
 }