M1\Vars\Loader\DirectoryLoader::load PHP Method

load() public method

public load ( )
    public function load()
    {
        $paths = array();
        $files = $this->recursive ? $this->getSupportedFilesRecursively() : $this->getSupportedFiles();
        foreach ($files as $path => $file) {
            if ($file->isFile()) {
                $paths[] = $path;
            }
        }
        $this->content = $this->makeResources($paths);
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * Returns the supported files using the extensions from the loaders in the entity which is a directory
  *
  * @see \M1\Vars\Loader\LoaderProvider::getExtensions() \M1\Vars\Loader\LoaderProvider::getExtensions()
  * @see \M1\Vars\Loader\LoaderProvider::makeLoaders() \M1\Vars\Loader\LoaderProvider::makeLoaders()
  *
  * @param string $entity The resource entity
  *
  * @return array|bool Returns the supported files or false if no files were found
  */
 private function getSupportedFilesInDir($entity)
 {
     $dir_loader = new DirectoryLoader($entity, $this->recursive);
     $dir_loader->setSupports($this->vars->loader->getExtensions());
     $dir_loader->load();
     return $dir_loader->getContent();
 }