Symfony\Component\Routing\Loader\PhpFileLoader::load PHP Méthode

load() public méthode

Loads an array of PHP files.
public load ( $file )
    public function load($file)
    {
        $loader = $this;

        $path = $this->findFile($file);

        $collection = include $path;
        $this->currentDir = dirname($path);
        $collection->addResource(new FileResource($path));

        return $collection;
    }

Usage Example

 /**
  * Routing wrapper constructor
  */
 public function __construct()
 {
     // grab the location of the routes-file
     $routeFile = Configuration::instance()->setting('base', 'routeFile', 'routes.php');
     // tell the loader to look for said file in the approot
     $locator = new FileLocator(APPROOT);
     // create a loader for a php file that'll return an array
     $this->loader = new PhpFileLoader($locator);
     // load the actual routes from the file
     $this->routes = $this->loader->load($routeFile);
     // create a fresh context for usage later on in the lifecycle
     $this->context = new RequestContext();
 }
All Usage Examples Of Symfony\Component\Routing\Loader\PhpFileLoader::load
PhpFileLoader