router = $router; } public function __invoke($params = array(), $options = array()) { if (null === $this->router) { return ''; } // Remove trailing '/index' from generated URLs. $url = $this->router->assemble($params, $options); if ((6 <= strlen($url)) && '/index' == substr($url, -6)) { $url = substr($url, 0, strlen($url) - 6); } return $url; } }