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

Breadcrumb

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

class ClosureLoader

Same name in this branch
  1. 11.1.x vendor/symfony/routing/Loader/ClosureLoader.php \Symfony\Component\Routing\Loader\ClosureLoader

ClosureLoader loads service definitions from a PHP closure.

The Closure has access to the container as its first argument.

@author Fabien Potencier <fabien@symfony.com>

Hierarchy

  • class \Symfony\Component\DependencyInjection\Loader\ClosureLoader extends \Symfony\Component\Config\Loader\Loader

Expanded class hierarchy of ClosureLoader

2 files declare their use of ClosureLoader
ExtensionTrait.php in vendor/symfony/dependency-injection/Extension/ExtensionTrait.php
Kernel.php in vendor/symfony/http-kernel/Kernel.php

File

vendor/symfony/dependency-injection/Loader/ClosureLoader.php, line 24

Namespace

Symfony\Component\DependencyInjection\Loader
View source
class ClosureLoader extends Loader {
    public function __construct(ContainerBuilder $container, ?string $env = null) {
        parent::__construct($env);
    }
    public function load(mixed $resource, ?string $type = null) : mixed {
        return $resource($this->container, $this->env);
    }
    public function supports(mixed $resource, ?string $type = null) : bool {
        return $resource instanceof \Closure;
    }

}

Members

Title Sort descending Modifiers Object type Summary
ClosureLoader::load public function
ClosureLoader::supports public function
ClosureLoader::__construct public function
RSS feed
Powered by Drupal