[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/vendor/symfony/routing/Symfony/Component/Routing/Loader/ -> ClosureLoader.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\Routing\Loader;
  13  
  14  use Symfony\Component\Config\Loader\Loader;
  15  use Symfony\Component\Routing\RouteCollection;
  16  
  17  /**
  18   * ClosureLoader loads routes from a PHP closure.
  19   *
  20   * The Closure must return a RouteCollection instance.
  21   *
  22   * @author Fabien Potencier <fabien@symfony.com>
  23   */
  24  class ClosureLoader extends Loader
  25  {
  26      /**
  27       * Loads a Closure.
  28       *
  29       * @param \Closure    $closure A Closure
  30       * @param string|null $type    The resource type
  31       *
  32       * @return RouteCollection A RouteCollection instance
  33       */
  34      public function load($closure, $type = null)
  35      {
  36          return $closure();
  37      }
  38  
  39      /**
  40       * {@inheritdoc}
  41       */
  42      public function supports($resource, $type = null)
  43      {
  44          return $resource instanceof \Closure && (!$type || 'closure' === $type);
  45      }
  46  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1