You are here

public function AnnotationFileLoader::load in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/routing/Loader/AnnotationFileLoader.php \Symfony\Component\Routing\Loader\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 vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php
Loads from annotations from a directory.

File

vendor/symfony/routing/Loader/AnnotationFileLoader.php, line 58

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;
}