Connects a new route and returns the current routes array. This method creates a new `Route` object and registers it with the `Router`. The order in which routes are connected matters, since the order of precedence is taken into account in parsing and matching operations.

Parameters

  • string $template An empty string, or a route string "/"
  • array $params An array describing the default or required elements of the route
  • array $options

Returns

array Array of routes

Source

						public static function connect($template, $params = array(), $options = array()) {
		if (!is_object($template)) {
			if (is_string($params)) {
				$params = static::_parseString($params, false);
			}
			if (isset($params[0]) && is_array($tmp = static::_parseString($params[0], false))) {
				unset($params[0]);
				$params = $tmp + $params;
			}
			if (is_callable($options)) {
				$options = array('handler' => $options);
			}
			$class = static::$_classes['route'];
			$template = new $class(compact('template', 'params') + $options);
		}
		return (static::$_configurations[] = $template);
	}