Add a 'CONNECT' route to be handled by the application.

@param callable|string|HttpPipeline|array $stages $stages
195279
public function connect(string $pattern, $stages): void
    {
        $pipeline = new HttpPipeline(RequestMethodInterface::METHOD_CONNECT, $this->prefix.$pattern, $this->routerStages);
        $pipeline->pipe($stages);
        $this->pipelineCollection->add($pipeline);
    }
976709
public function beforeStage($stage, $tasks, Application $application = null)
    {
        $this->addTaskToStage($tasks, $stage, $application, 'before');

        return $this;
    }
405415
public function dispatch(callable $controller, array $vars = [], BaseRoute $route = null)
    {
        if ($group = $route->getParentGroup()) {
            $this->response = (new PipelineProcessor())
                ->handlePayload(new Payload($group, $this->request, $this->response))
                ->getResponse();
        }

        $this->response = (new PipelineProcessor())
            ->handlePayload(new Payload($route, $this->request, $this->response))
            ->getResponse();

        return \call_user_func_array(
            $controller,
            [$this->request, $this->response, $vars]
        );
    }
575338
public Router connect(@NotNull final String pattern, @NotNull final IMiddleware... handlers) {
        addPattern("CONNECT", pattern, handlers, connectBindings);
        return this;
    }
557495
protected function routeDefault($segments = array(), $route)
    {
        // If we don't have any segments left - try the default controller;
        // WARNING: Directories get shifted out of the segments array!
        if (empty($segments))
        {
            $segments[0] = $this->config->routing->default_controller;
        }

        if ($this->config->routing->translate_uri_dashes === true)
        {
            $segments[0] = str_replace('-', '_', $segments[0]);
            if (isset($segments[1]))
            {
                $segments[1] = str_replace('-', '_', $segments[1]);
            }
        }

        // Prepare the values for loading
        $controller = $segments[0];
        $function = (isset($segments[1]) ? $segments[1] : $this->config->routing->default_function);

        // And prepare the Router URI
        array_unshift($segments, null);
        unset($segments[0]);
        $this->uri->rsegments = $segments;

        // Now create a matches array
        $matches = array(
                'controller' => $controller,
                'function' => $function,
                'parameters' => array_slice($this->uri->rsegments, 2)
            );

        // And finally load the callable
        $this->callable = array('\FuzeWorks\Router', 'defaultCallable');
        $this->loadCallable($matches, $route);
    }
384864
public function trace(string $pattern, $stages): void
    {
        $pipeline = new HttpPipeline(RequestMethodInterface::METHOD_TRACE, $this->prefix.$pattern, $this->routerStages);
        $pipeline->pipe($stages);
        $this->pipelineCollection->add($pipeline);
    }
24715
public function setConnect(array $connect): void
    {
        $this->connect = array_merge($this->connect, $connect);
        $this->checkConnect();
    }
192820
public function pushRouteCollection(array $routes)
    {
        foreach ($routes as $name => $route) {
            if (!array_key_exists('pattern', $route) || !array_key_exists('defaults', $route)) {
                $this->log('warning', sprintf('Unable to parse the route definition `%s`.', $name));
                continue;
            }

            $this->addRoute($name, $route);
        }

        $this->moveDefaultRoute();
    }
805496
protected function checkRoutesStructureValidity(array $routes): void
    {
        $requiredRouteParams = ['alias', 'parameters'];
        foreach ($routes as $routeKey => $route) {
            foreach ($requiredRouteParams as $requiredRouteParam) {
                if (! in_array($requiredRouteParam, array_keys($route))) {
                    throw new ErrorException(
                        'The « ' . $requiredRouteParam . ' » key is missing from the « ' . $routeKey
                        . ' » route definition. Each route key must contain an array with a (string) '
                        . '« alias » key and a (array) « parameters » value. Check the following example : '
                        . '["index" => ["alias" => "news.index","parameters" => []]. '
                        . 'Fix your routes declaration in the « setRoutes() » method.'
                    );
                }
            }
        }
    }
870691
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) {
        if (!empty($this->connection)) return $this->connection;

        $metaData         = new MetaData();
        $this->connection = new Connection($params, $this, new RoutingTable($metaData->getEntityNamespaces()));
        return $this->connection;
    }
521626
public function getHostsByStage($stage)
    {
        if (Host::isValidStage($stage) === false) {
            throw new UnexpectedValueException(sprintf("'%s' is not a valid stage.", $stage));
        }

        $hosts = array();
        foreach ($this->getHosts() as $host) {
            if ($host->getStage() === $stage) {
                $hosts[] = $host;
            }
        }

        return $hosts;
    }
468833
public function addRoutes(array $routes)
    {
        foreach ($routes as $route => $endpoint) {
            // Add route as key. Use rtrim to remove any existing trailing slash, and then
            // add a new trailing slash
            $route = ($route !== '/') ? rtrim($route, '/') : '/';
            $this->routes[$route] = $endpoint;
        }
    }
245772
public function pipe($stage)
    {
        $pipeline = clone $this;
        $this->handleStage($pipeline->stages, $stage);

        return $pipeline;
    }
673050
protected function processStages(array $stages, $payload, array $extra = [])
    {
        foreach ($stages as $key => $stage) {
            if ($this->isStageSelectable($key)) {
                $payload = $this->processStage($stage, $payload, $extra);
            }
        }

        return $payload;
    }
699635
public function setStage($stage)
    {
        $connectionKey = $this->getCurrentConnectionKey();
        if ($stage === $connectionKey->stage) {
            return;
        }

        $connectionKey->stage = $stage;
        $this->getConnections()->map(function (ConnectionInterface $connection) use ($connectionKey) {
            if ($connection->isCurrent() || $connection->getConnectionKey()->is($connectionKey)) {
                $connection->setConnectionKey($connectionKey);
            }

            return $connection;
        });

        // If we do have a stage, cleanup previous events
        if ($stage) {
            $this->bootstrapper->bootstrapUserCode();
        }
    }
63229
public function addRoutes(array $routes)
    {
        foreach ($routes as $name => $route) {
            $this->addRoute($name, $route);
        }
        return $this;
    }
424414
public function connect($route, $callable){
    if(!is_string($route)){
      throw new \InvalidArgumentException("Route to connect to callable musts be provided as a string");
    }
    if(!is_callable($callable)){
      throw new \InvalidArgumentException("Provided callable for $route is not valid.");
    }
    $this->routes[$route] = $callable;
  }