Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/routing/Loader/ClosureLoader.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
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 } |