public function map($method, $route, $target, $name = null, $hostGroup = null, $prepend = false)
    {
        if (!$hostGroup) {
            $hostGroup = null;
        }

        if ($prepend) {
            array_unshift($this->routes, array($method, $route, $target, $name, $hostGroup));
        } else {
            $this->routes[] = array($method, $route, $target, $name, $hostGroup);
        }

        if ($name) {
            if (array_key_exists($name, $this->namedRoutes)) {
                throw new HaltoRouterException("Can not redeclare route $name");
            }

            $this->namedRoutes[$name] = array($route, $hostGroup);
        }

        return $this;
    }
public function map($method, $route, $target, $name = null, $hostGroup = null, $prepend = false)
    {
        if (!$hostGroup) {
            $hostGroup = null;
        }

        if ($prepend) {
            array_unshift($this->routes, array($method, $route, $target, $name, $hostGroup));
        } else {
            $this->routes[] = array($method, $route, $target, $name, $hostGroup);
        }

        if ($name) {
            if (array_key_exists($name, $this->namedRoutes)) {
                throw new HaltoRouterException("Can not redeclare route $name");
            }

            $this->namedRoutes[$name] = array($route, $hostGroup);
        }

        return $this;
    }
public function map ( $ method , $ route , $ target , $ name = null , $ hostGroup = null , $ prepend = false ) { if ( ! $ hostGroup ) { $ hostGroup = null ; } if ( $ prepend ) { array_unshift ( $ this -> routes , array ( $ method , $ route , $ target , $ name , $ hostGroup ) ) ; } else { $ this -> routes [ ] = array ( $ method , $ route , $ target , $ name , $ hostGroup ) ; } if ( $ name ) { if ( array_key_exists ( $ name , $ this -> namedRoutes ) ) { throw new HaltoRouterException ( "Can not redeclare route $name" ) ; } $ this -> namedRoutes [ $ name ] = array ( $ route , $ hostGroup ) ; } return $ this ; }
Add a route mapping to the router.

@param string $method One, or a pipe-separated list, of Http Methods (GET|POST|PUT|DELETE)
@param string $route The route. Custom regex starts with @. You can use pre-set regex filters, like [i:id]
@param mixed  $target The target where this route should point to. Can be anything.
@param string $name Optional name of the route. Supply if you want to reverse route this url in your application.
@param string $hostGroup Optional hostGroup bound to route - the route will only match requests on these hosts.
@param bool   $prepend Optional

@return $this

@throws HaltoRouterException
Add a route mapping to the router .