Register route by $name

@param string $name
@param string $path
@param string $controller
@param string|array $methods
@param array $restrictTo
@param string $defaultResponse
@param array $options
431121
public static function register($name, $path, $controller, $methods=null, $restrictTo=null, $defaultResponse, $options=array()) {
		if( $methods && !is_array($methods) ) {
			$methods = array($methods);
		}
		foreach( static::$knownMethods as $method ) {
			if( (!$methods && !empty(static::$routes[$name][$method])) || ($methods && !in_array($method, $methods)) ) {
				continue;
			}
			static::$routes[$name][$method] = new static($name, $path, $controller, $method, $restrictTo, $defaultResponse, $options);
		}
	}
808422
public function post($path, $callable, $name = null) {
		return $this->add($path, $callable, $name, self::HTTP_METHOD_POST);
	}
1012987
public function controller($path, $class, array $names = [])
    {
        $methods = get_class_methods($class);

        foreach ($methods as $method)
        {
            // xxxxAction
            if (! preg_match('/(.+)Action$/i', $method, $matches))
                continue;

            if (is_object($class))
                $rule = $this->any($path, [$class, $method]);
            else
                $rule = $this->any($path, $class . '::' . $method);

            $rule->restful(false);
            $rule->setPath($path . '/' . $rule->methodName2URL($method));
        }
    }
1330474
private function addRoute($name, array $route)
    {
        extract($this->defaults($route));

        $requirements[RouteCollectionBuilder::K_NAME] = $name;

        $this->builder->addRoute($method, $pattern, $handler, $requirements, $defaults);
    }
625357
private function router($name, $val)
    {
        // Route object
        if (is_object($val)) {
            $this->renderObj($name, $val);
        }

        // Route indexed array
        if (is_array($val) && Utils::isArrayIndexed($val)) {
            $this->renderArrIndexed($name, $val);
        }

        // Route array with keys
        if (is_array($val) && !Utils::isArrayIndexed($val)) {
            $this->renderArrKeys($name, $val);
        }

        // Route strings/other
        if (!is_array($val) && !is_object($val)) {
            // Add to $this->code
            $this->renderResult($name, $val);

            // Clear out $this-code
            $this->code = '';

            // Exit
            return;
        }
    }
1082003
public function resource($name, $controller, array $options = array())
    {
        $registrar = $this->getRegistrar();

        $registrar->register($name, $controller, $options);
    }
992078
def register(path, name, options = {}, &block)
      path = path.to_s
      name = name.to_s
      prefix = path[-1]

      insure_path(path, name, options)
      return unless block_given?

      calls[path] = Command.new(prefix, name, options, &block)
    end
439457
public function register($name, $path, $absolute = false)
    {
        if($path instanceof \Exedra\Path)
            return $this->pathRegistry[$name] = $path;

        $path = $absolute ? $path : $this->basePath.'/'.ltrim($path, '/\\');

        $this->pathRegistry[$name] = new static($path);

        return $this->pathRegistry[$name];
    }
1346236
public function delete($name, $path, $controller = null)
    {
        $this->add('DELETE', $name, $path, $controller);
        return $this;
    }
445211
public function put($name, $path, $controller = null)
    {
        $this->add('PUT', $name, $path, $controller);
        return $this;
    }
1082901
protected function prefixedResource( $name, $controller, array $options )
	{
		list( $name, $prefix ) = $this->getResourcePrefix( $name );

		// We need to extract the base resource from the resource name. Nested resources
		// are supported in the framework, but we need to know what name to use for a
		// place-holder on the route parameters, which should be the base resources.
		$callback = function ( $me ) use ( $name, $controller, $options )
		{
			$me->resource( $name, $controller, $options );
		};

		$this->router->group( compact( 'prefix' ), $callback );
	}
338907
public function post($name, $path, $controller = null)
    {
        $this->add('POST', $name, $path, $controller);
        return $this;
    }
961436
public function controller( $uri, $controller, $names = [] )
	{
		$prepended = $controller;

		// First, we will check to see if a controller prefix has been registered in
		// the route group. If it has, we will need to prefix it before trying to
		// reflect into the class instance and pull out the method for routing.
		if ( !empty( $this->groupStack ) )
			$prepended = $this->prependGroupUses( $controller );

		$routable = ( new ControllerInspector )->getRoutable( $prepended, $uri );

		// When a controller is routed using this method, we use Reflection to parse
		// out all of the routable methods for the controller, then register each
		// route explicitly for the developers, so reverse routing is possible.
		foreach ( $routable as $method => $routes )
			foreach ( $routes as $route )
				$this->registerInspected( $route, $controller, $method, $names );

		$this->addFallthroughRoute( $controller, $uri );
	}
642115
public function route($name, $path, callable $callback)
    {
        // Modifying path from colon parameters /show/:id to bracket parameters /show/{id}
        $path = preg_replace("|(:(\w+))|", '{$2}', $path);

        // if the route is anonymous
        if (!$name) {
            $name = "N".uniqid();
        }

        $map = $this["router"]->getMap();
        $route = $map->route($name, $path, $callback);

        return $route;
    }
1318730
protected function handle(string $path, callable $action, $method, string $name = null): HttpRoute
    {
        if (!is_array($method)) {
            $method = [$method];
        }
        /** @var HttpRoute $route */
        $route = $this->data->createRoute($this->prefix . $path, $action, $name);
        $route->method(...$method);
        return $route;
    }
188131
public static function registerPartial($name, $partial)
    {
        Argument::i()
            //Argument 1 must be a string
            ->test(1, 'string')
            //Argument 2 must be a string
            ->test(2, 'string');

        self::$partials[$name] = $partial;
    }
19389
public function controller($uri, $controller, $names = [])
    {
        $arr = explode('\\', $controller);
        $controllerClassName = $arr[  sizeof($arr) -1  ];
        $routable = (new ControllerInspector)->getRoutable($this->addGroupNamespace($controller), $uri);
        foreach ($routable as $method => $routes) {
            if ($method == 'getMethodProperties') {
                continue;
            }

            foreach ($routes as $route) {
//  original code
//                $this->{$route['verb']}($route['uri'], [
//                        'uses' => $controller.'@'.$method,
//                        'as' => array_get($names, $method)
//                ]);
//                Route::{$route['verb']}( $route['uri'] ,  "{$controller}@{$method}" );

// should add middleware support later
                Route::{$route['verb']}( $route['uri'] ,  "{$controllerClassName}@{$method}" );

// middleware support not working as following
//                Route::{$route['verb']}( $route['uri'] ,  [
//                    'uses' => $controller.'@'.$method,
//                    'as' => array_get($names, $method)
//                ]);
            }
        }
    }