Overview

Namespaces

  • Evenement
  • None
  • PHP
  • Psr
    • Http
      • Message
  • Ratchet
    • Http
    • RFC6455
      • Handshake
      • Messaging
    • Server
    • Session
      • Serialize
      • Storage
        • Proxy
    • Wamp
    • WebSocket
  • React
    • EventLoop
      • Tick
      • Timer
    • Socket
    • Stream
  • Symfony
    • Component
      • HttpFoundation
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
      • Routing
        • Annotation
        • Exception
        • Generator
          • Dumper
        • Loader
          • DependencyInjection
        • Matcher
          • Dumper
        • Tests
          • Annotation
          • Fixtures
            • AnnotatedClasses
            • OtherAnnotatedClasses
          • Generator
            • Dumper
          • Loader
          • Matcher
            • Dumper

Classes

  • AnnotationClassLoader
  • AnnotationDirectoryLoader
  • AnnotationFileLoader
  • ClosureLoader
  • DirectoryLoader
  • ObjectRouteLoader
  • PhpFileLoader
  • RecursiveCallbackFilterIterator
  • XmlFileLoader
  • YamlFileLoader
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /*
 4:  * This file is part of the Symfony package.
 5:  *
 6:  * (c) Fabien Potencier <[email protected]>
 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\FileLoader;
15: use Symfony\Component\Routing\RouteCollection;
16: use Symfony\Component\Config\Resource\DirectoryResource;
17: 
18: class DirectoryLoader extends FileLoader
19: {
20:     /**
21:      * {@inheritdoc}
22:      */
23:     public function load($file, $type = null)
24:     {
25:         $path = $this->locator->locate($file);
26: 
27:         $collection = new RouteCollection();
28:         $collection->addResource(new DirectoryResource($path));
29: 
30:         foreach (scandir($path) as $dir) {
31:             if ('.' !== $dir[0]) {
32:                 $this->setCurrentDir($path);
33:                 $subPath = $path.'/'.$dir;
34:                 $subType = null;
35: 
36:                 if (is_dir($subPath)) {
37:                     $subPath .= '/';
38:                     $subType = 'directory';
39:                 }
40: 
41:                 $subCollection = $this->import($subPath, $subType, false, $path);
42:                 $collection->addCollection($subCollection);
43:             }
44:         }
45: 
46:         return $collection;
47:     }
48: 
49:     /**
50:      * {@inheritdoc}
51:      */
52:     public function supports($resource, $type = null)
53:     {
54:         // only when type is forced to directory, not to conflict with AnnotationLoader
55: 
56:         return 'directory' === $type;
57:     }
58: }
59: 
Ratchet API documentation generated by ApiGen 2.8.0