private function handleDispatch($request)
 {
     $collection = $this->router->getList();
     $context = new RequestContext();
     $context->fromRequest($request);
     $matcher = new UrlMatcher($collection, $context);
     $path = rtrim($request->getPathInfo(), '/') . '/';
     try {
         $request->attributes->add($matcher->match($path));
         $matched = $matcher->match($path);
         $route = $collection->get($matched['_route']);
         $this->router->setRequest($request);
         $response = $this->router->execute($route, $matched);
     } catch (ResourceNotFoundException $e) {
         $callback = $this->app->make(DispatcherRouteCallback::class, ['dispatcher']);
         $response = $callback->execute($request);
     }
     return $response;
 }
 /**
  * Get the RouteCollection from the router.
  *
  * @return RouteCollection
  */
 public function getRouteList()
 {
     return $this->router->getList();
 }