Render the file list.

@param array           $icons         The generated icons.
@param Collection|null $collection    The files collection.

@param bool            $followSubDirs If true subfolders get rendered.

@return void
968162
private function renderList(array &$icons, Collection $collection = null, $followSubDirs = false)
    {
        if (!$collection) {
            return;
        }

        foreach ($collection->getModels() as $model) {
            // File system and database seem not in sync
            if (!\file_exists($this->rootDir . '/' . $model->path)) {
                continue;
            }

            if (('folder' === $model->type) && $followSubDirs) {
                $this->renderList($icons, FilesModel::findByPid($model->uuid));
                continue;
            }
            if (false !== ($icon = $this->renderIcon($model, $this->isGallery, $this->isDownloads))) {
                $icons[\md5($model->uuid)] = ['uuid' => $model->uuid, 'image' => $icon];
            }
        }
    }
763478
public static function registerFonts($fonts = array())
    {
        if (empty($fonts))
            return;

        foreach ($fonts as $font) {
            Icon::registerIconFontSet($font);
        }
    }
635666
public function renderVersion(string $version, DataCollection $collection) : void
    {
        foreach ($this->writers as $writer) {
            $writer->renderVersion(
                [
                    'version' => $version,
                    'released' => $collection->getGenerationDate()->format('r'),
                    'format' => $writer->getFormatter()->getType(),
                    'type' => $writer->getFilter()->getType(),
                ]
            );
        }
    }
72303
public function nestedList(array $list, array $options = [], array $itemOptions = [])
    {
        $options = optionsParser($options);
        $itemOptions = optionsParser($itemOptions);

        if ($options->exists('icon')) {
            $itemOptions->add('icon', $options->get('icon'));
        }

        if ($itemOptions->exists('icon')) {
            $options->append('class', 'fa-ul');
            $itemOptions->append('icon', 'li');

            $list = array_map(function ($element) use ($itemOptions) {
                return collection($this->addIconToText($element, clone $itemOptions))->first();
            }, $list);
        }

        $options->delete('icon', 'icon-align');
        $itemOptions->delete('icon', 'icon-align');

        return parent::nestedList($list, $options->toArray(), $itemOptions->toArray());
    }
913584
public function folders($folders)
    {
        foreach((array) $folders as $folderPath)
        {
            if (! $this->file->exists($folderPath))
            {
                $this->file->makeDirectory($folderPath);
            }
        }
    }
437345
public function loadFiles($files)
    {
        $files = (array) $files;

        $success = true;
        foreach ($files as $file) {

            $this->loadFile($file);
        }
        return true;
    }
536981
protected function assetRendered($assets, $type): void
    {
        $assets = (array) $assets;

        foreach ($assets as $asset) {
            $this->renderedTags[] = $type.'::'.$asset;
        }
    }
833499
public function collections(array $collections) : void {
        foreach ($collections as $name => $callback) {
            $this->make($name, $callback);
        }
    }
471178
async function collecticonsBundle (params) {
  const {
    dirPath,
    destFile
  } = params;

  await validateDirPath(dirPath);

  const resultFiles = await collecticonsCompile({
    dirPath,
    styleFormats: ['css'],
    styleDest: './styles',
    fontDest: './',
    fontTypes: ['woff', 'woff2'],
    previewDest: './',
    noFileOutput: true
  });

  if (resultFiles === null) return;

  // Create zip.
  let zip = new JSZip();

  // Add generated files.
  resultFiles.forEach(file => {
    zip.file(file.path, file.contents);
  });

  // Add the icons.
  const dir = await fs.readdir(dirPath);
  const svgs = await Promise.all(dir.map(async file => {
    return file.endsWith('.svg')
      ? (
        {
          path: `icons/${file}`,
          contents: await fs.readFile(path.resolve(dirPath, file))
        }
      )
      : null;
  }));

  svgs.forEach(file => {
    zip.file(file.path, file.contents);
  });

  await fs.ensureDir(path.dirname(destFile));
  await fs.writeFile(destFile, zip.generate({ base64: false, compression: 'DEFLATE' }), 'binary');
}
1222166
public function execute($files)
  {
    printLn('=> PageWriter.');
    $pages = Application::db()->retrieve('page_list');

    $writer = new DataWriter();

    foreach($pages as $page) {
      $tmpl = $this->make_data($page);
      $writer->write($tmpl['slug'], 'index.html', $tmpl['html']);
    }
  }
875525
public function on($icon, array $classes = array(), $style='fas')
    {
        if (is_string($icon) === false) {
            throw new \InvalidArgumentException(
                'Icon label must be a string.'
            );
        }
        if (is_string($style) === false) {
            throw new \InvalidArgumentException(
                'The style label must be a string.'
            );
        }
        if (!in_array($style, $this->STYLES)) {
            throw new \InvalidArgumentException(
                'Invalid style.'
            );
        }

        $iconClasses = $icon . ' fa-stack-1x';

        if (count($classes) > 0) {
            foreach ($classes as $class) {
                $iconClasses .= ' ' . $this->classMapper($class);
            }
        }

        $this->bottomIcon = sprintf(self::ICON_HTML, $style, $iconClasses);

        return $this;
    }
1141014
protected function dispatchCollection($collection)
    {
        // find and send group variables
        $group = isset($collection['group']) ? $collection['group'] : null;
        // dispatch action dispatcher
        $content = $this->getActionDispatcher()->dispatch($collection['action'], $group);
        if (is_string($content)) {
            $this->sendContentString($content, $this->getRequest());
        }
    }
818265
public function render(IconSequence $icon)
    {
        $jsonBuilder = $this->getJsonBuilder()
            ->setValue('[icon]', $icon->getSymbol()->getVariable(), false)
            ->setValues($icon->getOptions());

        return $this->getFormatter()->renderObjectAssignment($icon, $jsonBuilder->build());
    }
591837
public function RenderChildCategories($sListFilterItemId = false, $bHideEmptyCategories = false, $bShowArticleCount = false, $iLevelCount = 1)
    {
        $sHtml = '';
        if (!is_null($this->oChildCategoryTreeList)) {
            $this->oChildCategoryTreeList->GoToStart();
            while ($oChildCategoryTree = $this->oChildCategoryTreeList->Next()) {
                $sHtml .= $oChildCategoryTree->Render($sListFilterItemId, $bHideEmptyCategories, $bShowArticleCount, $iLevelCount);
            }
        }

        return $sHtml;
    }
240684
protected function displayCombinedAssets($type, $files)
    {
        $isValid = $this->validateTypeCache($type, $files);
        
        // If the cache isn't valid, we build the cache
        $result = $isValid;
        if (!$isValid) {
            $result = $this->buildTypeCache($type, $files);
        }
        
        // If the cache is valid, load the file
        if ($result) {
            $hash = $this->getTypeHash($type);
            $cachedFile = $this->cachedFiles[$hash]['file'];
        
            echo $this->generateHtmlCode($type, $cachedFile);
        }
    }
827902
public function collection($label)
    {
        if (is_string($label) === false) {
            throw new \InvalidArgumentException(
                'Collection icon label must be a string.'
            );
        }

        if (isset($this->collection[$label]) === false) {
            throw new CollectionIconException(
                'Collection icon "' . $label . '" does not exist.'
            );
        }

        return $this->collection[$label];
    }
811689
public function merge(Collection $collection)
    {
        $this->requestCount += count($collection);
        foreach($collection as $item) {
            $this->add($item);
        }
    }