"Convert" a DOMElement object into a PHP variable.
public static xmlToVariable ( DOMElement $element ) : mixed | ||
$element | DOMElement | |
return | mixed |
/** * Returns the configuration for listeners. * * @return array * @since Method available since Release 3.4.0 */ public function getListenerConfiguration() { $result = array(); foreach ($this->xpath->query('listeners/listener') as $listener) { $class = (string)$listener->getAttribute('class'); $file = ''; $arguments = array(); if ($listener->hasAttribute('file')) { $file = $this->toAbsolutePath((string)$listener->getAttribute('file')); } if ($listener->childNodes->item(1) instanceof DOMElement && $listener->childNodes->item(1)->tagName == 'arguments') { foreach ($listener->childNodes->item(1)->childNodes as $argument) { if ($argument instanceof DOMElement) { if($argument->tagName == 'file' || $argument->tagName == 'directory') { $arguments[] = $this->toAbsolutePath((string)$argument->nodeValue); } else { $arguments[] = PHPUnit_Util_XML::xmlToVariable($argument); } } } } $result[] = array( 'class' => $class, 'file' => $file, 'arguments' => $arguments ); } return $result; }