private function bind($path, $call, array $options = []) { $options = $this->processOptions($options); if (!isset($options['method']) or !in_array($this->method, $options['method'])) { return; } $path = $this->helper->normalize($path); $path = implode($this->groups) . $path; $route = new Route(); $route->setOrigin($path); $path = $this->helper->compile($path); $prefix = null; if ($this->domain) { $route->setDomain($this->domain); $prefix = '<' . $this->domain . '>/'; } $key = null; if ($path) { $key = $prefix . $path; } $route->setPath($path); $route->setCallback($call); $route->setOptions($options); if ($this->controller) { $route->setController($this->controller); } if ($this->rest) { $route->setRest($this->rest); } if (isset($this->routes[$key])) { throw new RouteException(sprintf('Path %s already exists', $key)); } $this->routes[$key] = $this->lastRoute = $route; }