public function connect($template, $name, $controller = null, $metadata = array())
{
if (is_object($template)) {
$this->_customRoutes[$name] = $template;
} else {
$this->_routes[$name] = new Route($name, $template);
}
if ($metadata) {
$this->_metadata[$name] = $metadata;
}
if ($controller) {
$this->_controllers[$name] = $controller;
}
return $this;
}