Parses the config elements (default, requirement, option).
\DOMElement $node Element to parse that contains the configs:
string $path Full path of the XML file being processed:
array An array with the defaults as first item, requirements as second and options as third.
\InvalidArgumentException When the XML is invalid
private function parseConfigs(\DOMElement $node, $path) {
$defaults = array();
$requirements = array();
$options = array();
foreach ($node
->getElementsByTagNameNS(self::NAMESPACE_URI, '*') as $n) {
switch ($n->localName) {
case 'default':
if ($n
->hasAttribute('xsi:nil') && 'true' == $n
->getAttribute('xsi:nil')) {
$defaults[$n
->getAttribute('key')] = null;
}
else {
$defaults[$n
->getAttribute('key')] = trim($n->textContent);
}
break;
case 'requirement':
$requirements[$n
->getAttribute('key')] = trim($n->textContent);
break;
case 'option':
$options[$n
->getAttribute('key')] = trim($n->textContent);
break;
default:
throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "default", "requirement" or "option".', $n->localName, $path));
}
}
return array(
$defaults,
$requirements,
$options,
);
}