You are here

protected function XmlFileLoader::parseValues in Plug 7

Parses a collection of "value" XML nodes.

Parameters

\SimpleXMLElement $nodes The XML nodes:

Return value

array The values

3 calls to XmlFileLoader::parseValues()
XmlFileLoader::loadClassMetadataFromXml in lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php
Loads the validation metadata from the given XML class description.
XmlFileLoader::parseConstraints in lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php
Parses a collection of "constraint" XML nodes.
XmlFileLoader::parseOptions in lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php
Parses a collection of "option" XML nodes.

File

lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php, line 105

Class

XmlFileLoader
Loads validation metadata from an XML file.

Namespace

Symfony\Component\Validator\Mapping\Loader

Code

protected function parseValues(\SimpleXMLElement $nodes) {
  $values = array();
  foreach ($nodes as $node) {
    if (count($node) > 0) {
      if (count($node->value) > 0) {
        $value = $this
          ->parseValues($node->value);
      }
      elseif (count($node->constraint) > 0) {
        $value = $this
          ->parseConstraints($node->constraint);
      }
      else {
        $value = array();
      }
    }
    else {
      $value = trim($node);
    }
    if (isset($node['key'])) {
      $values[(string) $node['key']] = $value;
    }
    else {
      $values[] = $value;
    }
  }
  return $values;
}