code: public function router(RouterInterface $router)
      {
          $instanceof = $router instanceof PhrouteRouter;
  
          $this->router = $router;
  
          $routes = $instanceof ? $router->routes() : $this->collect();
  
          $this->dispatcher = new BaseDispatcher($routes, $this->resolver);
  
          return $this;
      }
docs: Sets the router and parse its available routes if needed.
  
  @param  \Rougin\Slytherin\Routing\RouterInterface $router
  @return self