public function match($url) {
		// Remove the start and end slash of URL
		$url = trim($url, '/');
		// Replace path parameters (:parameter) by
		$path = preg_replace_callback('#:([\w]+)#', [$this, 'paramMatch'], $this->path);
		// Define the regex patterb with the new path after replaced the parameters of path
		$regex = "#^$path$#i";

		// Check if the url matchs the path
		if (!preg_match($regex, $url, $matches)) {
			return false;
		}

		// Keep only the parameters
		array_shift($matches);

		return $matches;
	}
public function match($url) {
		// Remove the start and end slash of URL
		$url = trim($url, '/');
		// Replace path parameters (:parameter) by
		$path = preg_replace_callback('#:([\w]+)#', [$this, 'paramMatch'], $this->path);
		// Define the regex patterb with the new path after replaced the parameters of path
		$regex = "#^$path$#i";

		// Check if the url matchs the path
		if (!preg_match($regex, $url, $matches)) {
			return false;
		}

		// Keep only the parameters
		array_shift($matches);

		return $matches;
	}
public function match ( $ url ) { // Remove the start and end slash of URL $ url = trim ( $ url , '/' ) ; // Replace path parameters (:parameter) by $ path = preg_replace_callback ( '#:([\w]+)#' , [ $ this , 'paramMatch' ] , $ this -> path ) ; // Define the regex patterb with the new path after replaced the parameters of path $ regex = "#^$path$#i" ; // Check if the url matchs the path if ( ! preg_match ( $ regex , $ url , $ matches ) ) { return false ; } // Keep only the parameters array_shift ( $ matches ) ; return $ matches ; }
Test if the current route matches the URL

@param string $url

@return boolean|mixed
Test if the current route matches the URL