當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SimpleXMLElement::getAttributeAsPhp方法代碼示例

本文整理匯總了PHP中SimpleXMLElement::getAttributeAsPhp方法的典型用法代碼示例。如果您正苦於以下問題:PHP SimpleXMLElement::getAttributeAsPhp方法的具體用法?PHP SimpleXMLElement::getAttributeAsPhp怎麽用?PHP SimpleXMLElement::getAttributeAsPhp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SimpleXMLElement的用法示例。


在下文中一共展示了SimpleXMLElement::getAttributeAsPhp方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: recursiveRawDecode

 protected function recursiveRawDecode(array &$data, \SimpleXMLElement $node)
 {
     if ($node->count()) {
         if (!array_key_exists($node->getName(), $data)) {
             $data[$node->getName()] = [];
         }
         $row =& $data[$node->getName()];
         foreach ($node->children() as $child) {
             $this->recursiveRawDecode($row, $child);
         }
     } else {
         $newRow = array();
         /** @var SimpleXMLElement $attribute */
         foreach ($node->attributes() as $attribute) {
             $newRow[$attribute->getName()] = $node->getAttributeAsPhp($attribute->getName());
         }
         if ($node->getName() === $this->nodeName) {
             $data[] = $newRow;
         } else {
             $data[$node->getName()] = $newRow;
         }
     }
 }
開發者ID:alex63530,項目名稱:thelia,代碼行數:23,代碼來源:XMLFormatter.php

示例2: parseDefinition

 /**
  * Parses an individual ehough_iconic_Definition
  *
  * @param string           $id
  * @param SimpleXMLElement $service
  * @param string           $file
  */
 private function parseDefinition($id, $service, $file)
 {
     if ((string) $service['alias']) {
         $public = true;
         if (isset($service['public'])) {
             $public = $service->getAttributeAsPhp('public');
         }
         $this->container->setAlias($id, new ehough_iconic_Alias((string) $service['alias'], $public));
         return;
     }
     if (isset($service['parent'])) {
         $definition = new ehough_iconic_DefinitionDecorator((string) $service['parent']);
     } else {
         $definition = new ehough_iconic_Definition();
     }
     foreach (array('class', 'scope', 'public', 'factory-class', 'factory-method', 'factory-service', 'synthetic', 'synchronized', 'lazy', 'abstract') as $key) {
         if (isset($service[$key])) {
             $method = 'set' . str_replace('-', '', $key);
             $definition->{$method}((string) $service->getAttributeAsPhp($key));
         }
     }
     if ($service->file) {
         $definition->setFile((string) $service->file);
     }
     $definition->setArguments($service->getArgumentsAsPhp('argument'));
     $definition->setProperties($service->getArgumentsAsPhp('property'));
     if (isset($service->configurator)) {
         if (isset($service->configurator['function'])) {
             $definition->setConfigurator((string) $service->configurator['function']);
         } else {
             if (isset($service->configurator['service'])) {
                 $class = new ehough_iconic_Reference((string) $service->configurator['service'], ehough_iconic_ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
             } else {
                 $class = (string) $service->configurator['class'];
             }
             $definition->setConfigurator(array($class, (string) $service->configurator['method']));
         }
     }
     foreach ($service->call as $call) {
         $definition->addMethodCall((string) $call['method'], $call->getArgumentsAsPhp('argument'));
     }
     foreach ($service->tag as $tag) {
         $parameters = array();
         foreach ($tag->attributes() as $name => $value) {
             if ('name' === $name) {
                 continue;
             }
             $parameters[$name] = ehough_iconic_SimpleXMLElement::phpize($value);
         }
         $definition->addTag((string) $tag['name'], $parameters);
     }
     $this->container->setDefinition($id, $definition);
 }
開發者ID:jenia-buianov,項目名稱:all_my_sites,代碼行數:60,代碼來源:XmlFileLoader.php


注:本文中的SimpleXMLElement::getAttributeAsPhp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。