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)) {
			return (static::$_configurations[] = $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;
		}
		$params = static::_parseController($params);

		if (is_callable($options)) {
			$options = array('handler' => $options);
		}
		$config = compact('template', 'params') + $options + array(
			'formatters' => static::formatters(),
			'unicode' => static::$_unicode
		);
		return (static::$_configurations[] = static::_instance('route', $config));
	}