public function AnnotationFileLoader::load

Loads from annotations from a file.

Parameters

string $file A PHP file path:

string|null $type The resource type:

Return value

RouteCollection A RouteCollection instance

Throws

\InvalidArgumentException When the file does not exist or its routes cannot be parsed

1 method overrides AnnotationFileLoader::load()
AnnotationDirectoryLoader::load in drupal/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php
Loads from annotations from a directory.

File

drupal/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php, line 59

Class

AnnotationFileLoader
AnnotationFileLoader loads routing information from annotations set on a PHP class and its methods.

Namespace

Symfony\Component\Routing\Loader

Code

public function load($file, $type = null) {
  $path = $this->locator
    ->locate($file);
  $collection = new RouteCollection();
  if ($class = $this
    ->findClass($path)) {
    $collection
      ->addResource(new FileResource($path));
    $collection
      ->addCollection($this->loader
      ->load($class, $type));
  }
  return $collection;
}