Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Routing\Loader; Chris@0: Chris@0: use Symfony\Component\Config\Loader\FileLoader; Chris@0: use Symfony\Component\Routing\RouteCollection; Chris@0: Chris@0: /** Chris@0: * GlobFileLoader loads files from a glob pattern. Chris@0: * Chris@0: * @author Nicolas Grekas
Chris@0: */ Chris@0: class GlobFileLoader extends FileLoader Chris@0: { Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function load($resource, $type = null) Chris@0: { Chris@0: $collection = new RouteCollection(); Chris@0: Chris@0: foreach ($this->glob($resource, false, $globResource) as $path => $info) { Chris@0: $collection->addCollection($this->import($path)); Chris@0: } Chris@0: Chris@0: $collection->addResource($globResource); Chris@0: Chris@0: return $collection; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function supports($resource, $type = null) Chris@0: { Chris@0: return 'glob' === $type; Chris@0: } Chris@0: }