original_string: public function addMap($pattern, $controller)
  	{
  		// Sanitize and explode the pattern.
  		$pattern = explode('/', trim(parse_url((string) $pattern, PHP_URL_PATH), ' /'));
  
  		// Prepare the route variables
  		$vars = array();
  
  		// Initialize regular expression
  		$regex = array();
  
  		// Loop on each segment
  		foreach ($pattern as $segment)
  		{
  			if ($segment == '*')
  			{
  				// Match a splat with no variable.
  				$regex[] = '.*';
  			}
  			elseif ($segment[0] == '*')
  			{
  				// Match a splat and capture the data to a named variable.
  				$vars[]  = substr($segment, 1);
  				$regex[] = '(.*)';
  			}
  			elseif ($segment[0] == '\\' && $segment[1] == '*')
  			{
  				// Match an escaped splat segment.
  				$regex[] = '\*' . preg_quote(substr($segment, 2));
  			}
  			elseif ($segment == ':')
  			{
  				// Match an unnamed variable without capture.
  				$regex[] = '[^/]*';
  			}
  			elseif ($segment[0] == ':')
  			{
  				// Match a named variable and capture the data.
  				$vars[]  = substr($segment, 1);
  				$regex[] = '([^/]*)';
  			}
  			elseif ($segment[0] == '\\' && $segment[1] == ':')
  			{
  				// Match a segment with an escaped variable character prefix.
  				$regex[] = preg_quote(substr($segment, 1));
  			}
  			else
  			{
  				// Match the standard segment.
  				$regex[] = preg_quote($segment);
  			}
  		}
  
  		$this->maps[] = array(
  			'regex'      => \chr(1) . '^' . implode('/', $regex) . '$' . \chr(1),
  			'vars'       => $vars,
  			'controller' => (string) $controller,
  		);
  
  		return $this;
  	}
code: public function addMap($pattern, $controller)
  	{
  		// Sanitize and explode the pattern.
  		$pattern = explode('/', trim(parse_url((string) $pattern, PHP_URL_PATH), ' /'));
  
  		// Prepare the route variables
  		$vars = array();
  
  		// Initialize regular expression
  		$regex = array();
  
  		// Loop on each segment
  		foreach ($pattern as $segment)
  		{
  			if ($segment == '*')
  			{
  				// Match a splat with no variable.
  				$regex[] = '.*';
  			}
  			elseif ($segment[0] == '*')
  			{
  				// Match a splat and capture the data to a named variable.
  				$vars[]  = substr($segment, 1);
  				$regex[] = '(.*)';
  			}
  			elseif ($segment[0] == '\\' && $segment[1] == '*')
  			{
  				// Match an escaped splat segment.
  				$regex[] = '\*' . preg_quote(substr($segment, 2));
  			}
  			elseif ($segment == ':')
  			{
  				// Match an unnamed variable without capture.
  				$regex[] = '[^/]*';
  			}
  			elseif ($segment[0] == ':')
  			{
  				// Match a named variable and capture the data.
  				$vars[]  = substr($segment, 1);
  				$regex[] = '([^/]*)';
  			}
  			elseif ($segment[0] == '\\' && $segment[1] == ':')
  			{
  				// Match a segment with an escaped variable character prefix.
  				$regex[] = preg_quote(substr($segment, 1));
  			}
  			else
  			{
  				// Match the standard segment.
  				$regex[] = preg_quote($segment);
  			}
  		}
  
  		$this->maps[] = array(
  			'regex'      => \chr(1) . '^' . implode('/', $regex) . '$' . \chr(1),
  			'vars'       => $vars,
  			'controller' => (string) $controller,
  		);
  
  		return $this;
  	}
code_tokens: public function addMap ( $ pattern , $ controller ) { // Sanitize and explode the pattern. $ pattern = explode ( '/' , trim ( parse_url ( ( string ) $ pattern , PHP_URL_PATH ) , ' /' ) ) ; // Prepare the route variables $ vars = array ( ) ; // Initialize regular expression $ regex = array ( ) ; // Loop on each segment foreach ( $ pattern as $ segment ) { if ( $ segment == '*' ) { // Match a splat with no variable. $ regex [ ] = '.*' ; } elseif ( $ segment [ 0 ] == '*' ) { // Match a splat and capture the data to a named variable. $ vars [ ] = substr ( $ segment , 1 ) ; $ regex [ ] = '(.*)' ; } elseif ( $ segment [ 0 ] == '\\' && $ segment [ 1 ] == '*' ) { // Match an escaped splat segment. $ regex [ ] = '\*' . preg_quote ( substr ( $ segment , 2 ) ) ; } elseif ( $ segment == ':' ) { // Match an unnamed variable without capture. $ regex [ ] = '[^/]*' ; } elseif ( $ segment [ 0 ] == ':' ) { // Match a named variable and capture the data. $ vars [ ] = substr ( $ segment , 1 ) ; $ regex [ ] = '([^/]*)' ; } elseif ( $ segment [ 0 ] == '\\' && $ segment [ 1 ] == ':' ) { // Match a segment with an escaped variable character prefix. $ regex [ ] = preg_quote ( substr ( $ segment , 1 ) ) ; } else { // Match the standard segment. $ regex [ ] = preg_quote ( $ segment ) ; } } $ this -> maps [ ] = array ( 'regex' => \ chr ( 1 ) . '^' . implode ( '/' , $ regex ) . '$' . \ chr ( 1 ) , 'vars' => $ vars , 'controller' => ( string ) $ controller , ) ; return $ this ; }
docstring: Add a route map to the router. If the pattern already exists it will be overwritten.
  
  @param   string  $pattern     The route pattern to use for matching.
  @param   string  $controller  The controller name to map to the given pattern.
  
  @return  Router  Returns itself to support chaining.
  
  @since   1.0
  @deprecated  2.0  Deprecated without replacement
docstring_tokens: Add a route map to the router . If the pattern already exists it will be overwritten .