You are here

class ClosureLoader in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/symfony/routing/Loader/ClosureLoader.php \Symfony\Component\Routing\Loader\ClosureLoader
  2. 8.0 vendor/symfony/dependency-injection/Loader/ClosureLoader.php \Symfony\Component\DependencyInjection\Loader\ClosureLoader
Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/Loader/ClosureLoader.php \Symfony\Component\DependencyInjection\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

3 files declare their use of ClosureLoader
ClosureLoaderTest.php in vendor/symfony/dependency-injection/Tests/Loader/ClosureLoaderTest.php
ContainerBuilderTest.php in vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.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 {
  private $container;

  /**
   * Constructor.
   *
   * @param ContainerBuilder $container A ContainerBuilder instance
   */
  public function __construct(ContainerBuilder $container) {
    $this->container = $container;
  }

  /**
   * {@inheritdoc}
   */
  public function load($resource, $type = null) {
    call_user_func($resource, $this->container);
  }

  /**
   * {@inheritdoc}
   */
  public function supports($resource, $type = null) {
    return $resource instanceof \Closure;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ClosureLoader::$container private property
ClosureLoader::load public function
ClosureLoader::supports public function
ClosureLoader::__construct public function Constructor.