original_string: public function getRouteCollectionForType($type)
      {
          if (isset($this->collections[$type])) {
              return $this->collections[$type];
          }
  
          if (!$this->metadataFactory->hasMetadataFor($type)) {
              throw new ResourceNotFoundException(sprintf('No metadata found for module type "%s".', $type));
          }
  
          $metadata = $this->metadataFactory->getMetadataFor($type);
          $routes   = $metadata->getRoutes();
  
          // Add modular prefix to the collection
          $this->provider->addModularPrefix($routes);
  
          // Add route prefix to the collection
          $routes->addPrefix(
              $this->routePrefix['path'],
              $this->routePrefix['defaults'],
              $this->routePrefix['requirements']
          );
  
          return $this->collections[$type] = $routes;
      }
code: public function getRouteCollectionForType($type)
      {
          if (isset($this->collections[$type])) {
              return $this->collections[$type];
          }
  
          if (!$this->metadataFactory->hasMetadataFor($type)) {
              throw new ResourceNotFoundException(sprintf('No metadata found for module type "%s".', $type));
          }
  
          $metadata = $this->metadataFactory->getMetadataFor($type);
          $routes   = $metadata->getRoutes();
  
          // Add modular prefix to the collection
          $this->provider->addModularPrefix($routes);
  
          // Add route prefix to the collection
          $routes->addPrefix(
              $this->routePrefix['path'],
              $this->routePrefix['defaults'],
              $this->routePrefix['requirements']
          );
  
          return $this->collections[$type] = $routes;
      }
code_tokens: public function getRouteCollectionForType ( $ type ) { if ( isset ( $ this -> collections [ $ type ] ) ) { return $ this -> collections [ $ type ] ; } if ( ! $ this -> metadataFactory -> hasMetadataFor ( $ type ) ) { throw new ResourceNotFoundException ( sprintf ( 'No metadata found for module type "%s".' , $ type ) ) ; } $ metadata = $ this -> metadataFactory -> getMetadataFor ( $ type ) ; $ routes = $ metadata -> getRoutes ( ) ; // Add modular prefix to the collection $ this -> provider -> addModularPrefix ( $ routes ) ; // Add route prefix to the collection $ routes -> addPrefix ( $ this -> routePrefix [ 'path' ] , $ this -> routePrefix [ 'defaults' ] , $ this -> routePrefix [ 'requirements' ] ) ; return $ this -> collections [ $ type ] = $ routes ; }
docstring: Returns the route collection for a module type.
  
  @param string $type
  
  @return RouteCollection
docstring_tokens: Returns the route collection for a module type .