routeParser = $routeParser; $this->dataGenerator = $dataGenerator; } /** * Adds a route to the collection. * * The syntax used in the $route string depends on the used route parser. * * @param string|string[] $httpMethod * @param string $route * @param mixed $handler */ public function addRoute($httpMethod, $route, $handler) { $routeDatas = $this->routeParser->parse($route); foreach ((array) $httpMethod as $method) { foreach ($routeDatas as $routeData) { $this->dataGenerator->addRoute($method, $routeData, $handler); } } } /** * Returns the collected route data, as provided by the data generator. * * @return array */ public function getData() { return $this->dataGenerator->getData(); } }