protected function XmlFileLoader::parseConstraints in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php \Symfony\Component\Validator\Mapping\Loader\XmlFileLoader::parseConstraints()
Parses a collection of "constraint" XML nodes.
Parameters
\SimpleXMLElement $nodes The XML nodes:
Return value
array The Constraint instances
3 calls to XmlFileLoader::parseConstraints()
- XmlFileLoader::loadClassMetadataFromXml in vendor/
symfony/ validator/ Mapping/ Loader/ XmlFileLoader.php - Loads the validation metadata from the given XML class description.
- XmlFileLoader::parseOptions in vendor/
symfony/ validator/ Mapping/ Loader/ XmlFileLoader.php - Parses a collection of "option" XML nodes.
- XmlFileLoader::parseValues in vendor/
symfony/ validator/ Mapping/ Loader/ XmlFileLoader.php - Parses a collection of "value" XML nodes.
File
- vendor/
symfony/ validator/ Mapping/ Loader/ XmlFileLoader.php, line 71
Class
- XmlFileLoader
- Loads validation metadata from an XML file.
Namespace
Symfony\Component\Validator\Mapping\LoaderCode
protected function parseConstraints(\SimpleXMLElement $nodes) {
$constraints = array();
foreach ($nodes as $node) {
if (count($node) > 0) {
if (count($node->value) > 0) {
$options = $this
->parseValues($node->value);
}
elseif (count($node->constraint) > 0) {
$options = $this
->parseConstraints($node->constraint);
}
elseif (count($node->option) > 0) {
$options = $this
->parseOptions($node->option);
}
else {
$options = array();
}
}
elseif (strlen((string) $node) > 0) {
$options = trim($node);
}
else {
$options = null;
}
$constraints[] = $this
->newConstraint((string) $node['name'], $options);
}
return $constraints;
}