/**
  * Returns routes that are defined directly in the application.
  *
  * Routes from vendor bundles are not considered.
  *
  * @param RouterInterface $router
  * @return Route[]
  */
 protected function getApplicationRoutes(RouterInterface $router)
 {
     $applicationRoutes = clone $router->getRouteCollection();
     $resources = $router->getRouteCollection()->getResources();
     foreach ($resources as $resource) {
         /* @var $resource ResourceInterface */
         if (!$resource instanceof FileResource) {
             // Only consider file resources as the other ones
             // (for example Assetic resources) cannot be handled.
             continue;
         }
         if (!VendorResources::isVendorFile((string) $resource)) {
             continue;
         }
         /* @var $loader LoaderInterface */
         $loader = $this->getContainer()->get('routing.loader');
         /* @var $vendorRoutes RouteCollection */
         $vendorRoutes = $loader->load((string) $resource);
         $applicationRoutes->remove(array_keys($vendorRoutes->all()));
     }
     return $applicationRoutes->all();
 }
 /**
  * Ensures that isVendorFile() throws an exception if the given path does not reference
  * an existing file.
  */
 public function testIsVendorFileThrowsExceptionIfNoValidFileReferenceIsProvided()
 {
     $this->setExpectedException('InvalidArgumentException');
     VendorResources::isVendorFile(__DIR__ . '/this/files/does/not/exist');
 }