src/routing.php
private function find_handler() {
	$handler = false;
	
	// empty url leads to the default handler
	if (empty($this->url)) {
		return $this->default_handler;
	}
	
	// simple mapping urls to the filesystem
	if ($this->map_to_filesystem && $this->find_handler_path($this->url)) {
		// url == handler
		return $this->url;
	}
	
	// custom mapping via regex to various handler formats
	if ($this->map_to_filesystem == false) {
		$handler = $this->find_custom_handler();
		// don't return, it could be a 404
	}
	
	// fallback for unmatched requests
	if (empty($handler) && $this->fallback_to_default) {
		return $this->default_handler;
	}
	
	// 404 when file or regex is unmatched
	return $handler;
}
private function find_handler() {
	$handler = false;
	
	// empty url leads to the default handler
	if (empty($this->url)) {
		return $this->default_handler;
	}
	
	// simple mapping urls to the filesystem
	if ($this->map_to_filesystem && $this->find_handler_path($this->url)) {
		// url == handler
		return $this->url;
	}
	
	// custom mapping via regex to various handler formats
	if ($this->map_to_filesystem == false) {
		$handler = $this->find_custom_handler();
		// don't return, it could be a 404
	}
	
	// fallback for unmatched requests
	if (empty($handler) && $this->fallback_to_default) {
		return $this->default_handler;
	}
	
	// 404 when file or regex is unmatched
	return $handler;
}
private function find_handler ( ) { $ handler = false ; // empty url leads to the default handler if ( empty ( $ this -> url ) ) { return $ this -> default_handler ; } // simple mapping urls to the filesystem if ( $ this -> map_to_filesystem && $ this -> find_handler_path ( $ this -> url ) ) { // url == handler return $ this -> url ; } // custom mapping via regex to various handler formats if ( $ this -> map_to_filesystem == false ) { $ handler = $ this -> find_custom_handler ( ) ; // don't return, it could be a 404 } // fallback for unmatched requests if ( empty ( $ handler ) && $ this -> fallback_to_default ) { return $ this -> default_handler ; } // 404 when file or regex is unmatched return $ handler ; }
find a handler for the requested url

checks the filesystem directly if $this->map_to_filesystem is true
checks user defined routes otherwise

gives the default handler for empty url ..
.. or when $this->fallback_to_default is true

@return mixed $handler see get_handler_type()
find a handler for the requested url