public function loadComponents (ComponentType $type) : array
    {
        $path = "{$this->templatesDir}/{$type->getDirectory()}";

        if (!is_dir($path) || !is_readable($path))
        {
            return [];
        }

        $finder = new Finder();
        $files = $finder
            ->files()
            ->in($path)
            ->depth("== 0")
            ->name("*.html.twig")
            ->sortByName();

        $result = [];

        foreach ($files as $file)
        {
            $component = new Component($file, $this->templatePrefix, $type);
            $result[$component->getKey()] = $component;
        }

        return $result;
    }
public function loadComponents (ComponentType $type) : array
    {
        $path = "{$this->templatesDir}/{$type->getDirectory()}";

        if (!is_dir($path) || !is_readable($path))
        {
            return [];
        }

        $finder = new Finder();
        $files = $finder
            ->files()
            ->in($path)
            ->depth("== 0")
            ->name("*.html.twig")
            ->sortByName();

        $result = [];

        foreach ($files as $file)
        {
            $component = new Component($file, $this->templatePrefix, $type);
            $result[$component->getKey()] = $component;
        }

        return $result;
    }
public function loadComponents ( ComponentType $ type ) : array { $ path = "{$this->templatesDir}/{$type->getDirectory()}" ; if ( ! is_dir ( $ path ) || ! is_readable ( $ path ) ) { return [ ] ; } $ finder = new Finder ( ) ; $ files = $ finder -> files ( ) -> in ( $ path ) -> depth ( "== 0" ) -> name ( "*.html.twig" ) -> sortByName ( ) ; $ result = [ ] ; foreach ( $ files as $ file ) { $ component = new Component ( $ file , $ this -> templatePrefix , $ type ) ; $ result [ $ component -> getKey ( ) ] = $ component ; } return $ result ; }
Loads all components for the given type

@param ComponentType $type

@return Component[] indexed by component key
Loads all components for the given type