Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AttributeFileLoader.php

function AttributeFileLoader::load

Loads from attributes from a file.

Throws

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

2 calls to AttributeFileLoader::load()
AttributeDirectoryLoader::load in vendor/symfony/routing/Loader/AttributeDirectoryLoader.php
AttributeDirectoryLoader::load in vendor/symfony/routing/Loader/AttributeDirectoryLoader.php
1 method overrides AttributeFileLoader::load()
AttributeDirectoryLoader::load in vendor/symfony/routing/Loader/AttributeDirectoryLoader.php

File

vendor/symfony/routing/Loader/AttributeFileLoader.php, line 44

Class

AttributeFileLoader
AttributeFileLoader loads routing information from attributes set on a PHP class and its methods.

Namespace

Symfony\Component\Routing\Loader

Code

public function load(mixed $file, ?string $type = null) : ?RouteCollection {
    $path = $this->locator
        ->locate($file);
    $collection = new RouteCollection();
    if ($class = $this->findClass($path)) {
        $refl = new \ReflectionClass($class);
        if ($refl->isAbstract()) {
            return null;
        }
        $collection->addResource(new FileResource($path));
        $collection->addCollection($this->loader
            ->load($class, $type));
    }
    gc_mem_caches();
    return $collection;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal