original_string: private function parseMenu(\DOMNode $menu) {
  
  		$root = $menu->getAttribute('script');
  
  		if(!$root) {
  			if($this->site) {
  				$root= $this->site->root_document ?: 'index.php';
  			}
  			else {
  				$root= 'index.php';
  			}
  		}
  
  		$type = $menu->getAttribute('type') === 'dynamic' ? 'dynamic' : 'static';
  		$service = $menu->getAttribute('service') ?: NULL;
  		$id = $menu->getAttribute('id') ?: NULL;
  
  		if($type === 'dynamic' && !$service) {
  			throw new ConfigException("A dynamic menu requires a configured service.");
  		}
  
  		$m = new Menu(
  			$root,
  			$id,
  			$type,
  			$service
  		);
  
  		if(($menuAuth = strtolower(trim($menu->getAttribute('auth'))))) {
  
  			$m->setAuth($menuAuth);
  
  			// if an auth level is defined, additional authentication parameters can be set
  
  			if(($authParameters = $menu->getAttribute('auth_parameters'))) {
  				$m->setAuthParameters($authParameters);
  			}
  
  		}
  
  		$this->appendMenuEntries($menu->childNodes, $m);
  
  		return $m;
  
  	}
code: private function parseMenu(\DOMNode $menu) {
  
  		$root = $menu->getAttribute('script');
  
  		if(!$root) {
  			if($this->site) {
  				$root= $this->site->root_document ?: 'index.php';
  			}
  			else {
  				$root= 'index.php';
  			}
  		}
  
  		$type = $menu->getAttribute('type') === 'dynamic' ? 'dynamic' : 'static';
  		$service = $menu->getAttribute('service') ?: NULL;
  		$id = $menu->getAttribute('id') ?: NULL;
  
  		if($type === 'dynamic' && !$service) {
  			throw new ConfigException("A dynamic menu requires a configured service.");
  		}
  
  		$m = new Menu(
  			$root,
  			$id,
  			$type,
  			$service
  		);
  
  		if(($menuAuth = strtolower(trim($menu->getAttribute('auth'))))) {
  
  			$m->setAuth($menuAuth);
  
  			// if an auth level is defined, additional authentication parameters can be set
  
  			if(($authParameters = $menu->getAttribute('auth_parameters'))) {
  				$m->setAuthParameters($authParameters);
  			}
  
  		}
  
  		$this->appendMenuEntries($menu->childNodes, $m);
  
  		return $m;
  
  	}
code_tokens: private function parseMenu ( \ DOMNode $ menu ) { $ root = $ menu -> getAttribute ( 'script' ) ; if ( ! $ root ) { if ( $ this -> site ) { $ root = $ this -> site -> root_document ? : 'index.php' ; } else { $ root = 'index.php' ; } } $ type = $ menu -> getAttribute ( 'type' ) === 'dynamic' ? 'dynamic' : 'static' ; $ service = $ menu -> getAttribute ( 'service' ) ? : NULL ; $ id = $ menu -> getAttribute ( 'id' ) ? : NULL ; if ( $ type === 'dynamic' && ! $ service ) { throw new ConfigException ( "A dynamic menu requires a configured service." ) ; } $ m = new Menu ( $ root , $ id , $ type , $ service ) ; if ( ( $ menuAuth = strtolower ( trim ( $ menu -> getAttribute ( 'auth' ) ) ) ) ) { $ m -> setAuth ( $ menuAuth ) ; // if an auth level is defined, additional authentication parameters can be set if ( ( $ authParameters = $ menu -> getAttribute ( 'auth_parameters' ) ) ) { $ m -> setAuthParameters ( $ authParameters ) ; } } $ this -> appendMenuEntries ( $ menu -> childNodes , $ m ) ; return $ m ; }
docstring: Parse XML menu entries and creates menu instance
  
  @param \DOMNode $menu
  @return Menu
  @throws ConfigException
docstring_tokens: Parse XML menu entries and creates menu instance