src/Runner/ConfigParser.php
public function parse( $filename ) {
		if( !is_readable($filename) ) {
			throw new ConfigException("Config file '{$filename}' not readable");
		}

		$dom = new \DOMDocument();
		if( @$dom->load($filename) === false ) {
			throw new ConfigException("Error parsing {$filename}");
		}

		$root = $dom->firstChild;
		if( !$root instanceof \DOMElement ) {
			throw new \RuntimeException('Needs a DOM element');
		}

		$docRoot = new Documentation\DocRoot([], []);
		if( $root->nodeName == 'mddoc' ) {
			$this->loadChildren($root, $docRoot);
		} else {
			if( $root->nodeName ) {
				throw new ConfigException("XML Root element `{$root->nodeName}` is invalid.");
			}

			throw new ConfigException("Error parsing {$filename}");
		}

		return $docRoot;
	}
public function parse( $filename ) {
		if( !is_readable($filename) ) {
			throw new ConfigException("Config file '{$filename}' not readable");
		}

		$dom = new \DOMDocument();
		if( @$dom->load($filename) === false ) {
			throw new ConfigException("Error parsing {$filename}");
		}

		$root = $dom->firstChild;
		if( !$root instanceof \DOMElement ) {
			throw new \RuntimeException('Needs a DOM element');
		}

		$docRoot = new Documentation\DocRoot([], []);
		if( $root->nodeName == 'mddoc' ) {
			$this->loadChildren($root, $docRoot);
		} else {
			if( $root->nodeName ) {
				throw new ConfigException("XML Root element `{$root->nodeName}` is invalid.");
			}

			throw new ConfigException("Error parsing {$filename}");
		}

		return $docRoot;
	}
public function parse ( $ filename ) { if ( ! is_readable ( $ filename ) ) { throw new ConfigException ( "Config file '{$filename}' not readable" ) ; } $ dom = new \ DOMDocument ( ) ; if ( @ $ dom -> load ( $ filename ) === false ) { throw new ConfigException ( "Error parsing {$filename}" ) ; } $ root = $ dom -> firstChild ; if ( ! $ root instanceof \ DOMElement ) { throw new \ RuntimeException ( 'Needs a DOM element' ) ; } $ docRoot = new Documentation \ DocRoot ( [ ] , [ ] ) ; if ( $ root -> nodeName == 'mddoc' ) { $ this -> loadChildren ( $ root , $ docRoot ) ; } else { if ( $ root -> nodeName ) { throw new ConfigException ( "XML Root element `{$root->nodeName}` is invalid." ) ; } throw new ConfigException ( "Error parsing {$filename}" ) ; } return $ docRoot ; }
Parse a config file

@param string $filename
@return \donatj\MDDoc\Documentation\DocRoot
@throws \donatj\MDDoc\Exceptions\ConfigException
Parse a config file