You are here

class ClosureLoader in Zircon Profile 8

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

ClosureLoader loads routes from a PHP closure.

The Closure must return a RouteCollection instance.

@author Fabien Potencier <fabien@symfony.com>

Hierarchy

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

Expanded class hierarchy of ClosureLoader

1 file declares its use of ClosureLoader
ClosureLoaderTest.php in vendor/symfony/routing/Tests/Loader/ClosureLoaderTest.php

File

vendor/symfony/routing/Loader/ClosureLoader.php, line 24

Namespace

Symfony\Component\Routing\Loader
View source
class ClosureLoader extends Loader {

  /**
   * Loads a Closure.
   *
   * @param \Closure    $closure A Closure
   * @param string|null $type    The resource type
   *
   * @return RouteCollection A RouteCollection instance
   */
  public function load($closure, $type = null) {
    return $closure();
  }

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

}

Members

Namesort descending Modifiers Type Description Overrides
ClosureLoader::load public function Loads a Closure.
ClosureLoader::supports public function