original_string: private function load($resource, string $type = null): array
      {
          if (null === $this->loader) {
              throw new \BadMethodCallException('Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.');
          }
  
          if ($this->loader->supports($resource, $type)) {
              $collections = $this->loader->load($resource, $type);
  
              return \is_array($collections) ? $collections : [$collections];
          }
  
          if (null === $resolver = $this->loader->getResolver()) {
              throw new LoaderLoadException($resource, null, null, null, $type);
          }
  
          if (false === $loader = $resolver->resolve($resource, $type)) {
              throw new LoaderLoadException($resource, null, null, null, $type);
          }
  
          $collections = $loader->load($resource, $type);
  
          return \is_array($collections) ? $collections : [$collections];
      }
code: private function load($resource, string $type = null): array
      {
          if (null === $this->loader) {
              throw new \BadMethodCallException('Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.');
          }
  
          if ($this->loader->supports($resource, $type)) {
              $collections = $this->loader->load($resource, $type);
  
              return \is_array($collections) ? $collections : [$collections];
          }
  
          if (null === $resolver = $this->loader->getResolver()) {
              throw new LoaderLoadException($resource, null, null, null, $type);
          }
  
          if (false === $loader = $resolver->resolve($resource, $type)) {
              throw new LoaderLoadException($resource, null, null, null, $type);
          }
  
          $collections = $loader->load($resource, $type);
  
          return \is_array($collections) ? $collections : [$collections];
      }
code_tokens: private function load ( $ resource , string $ type = null ) : array { if ( null === $ this -> loader ) { throw new \ BadMethodCallException ( 'Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.' ) ; } if ( $ this -> loader -> supports ( $ resource , $ type ) ) { $ collections = $ this -> loader -> load ( $ resource , $ type ) ; return \ is_array ( $ collections ) ? $ collections : [ $ collections ] ; } if ( null === $ resolver = $ this -> loader -> getResolver ( ) ) { throw new LoaderLoadException ( $ resource , null , null , null , $ type ) ; } if ( false === $ loader = $ resolver -> resolve ( $ resource , $ type ) ) { throw new LoaderLoadException ( $ resource , null , null , null , $ type ) ; } $ collections = $ loader -> load ( $ resource , $ type ) ; return \ is_array ( $ collections ) ? $ collections : [ $ collections ] ; }
docstring: Finds a loader able to load an imported resource and loads it.
  
  @param mixed       $resource A resource
  @param string|null $type     The resource type or null if unknown
  
  @return RouteCollection[]
  
  @throws LoaderLoadException If no loader is found
docstring_tokens: Finds a loader able to load an imported resource and loads it .