MetaModels\Helper\ToolboxFile::addFileModels PHP Method

addFileModels() private method

Must either be called from within collectFiles or collectFiles must be called later on as this method will add models of type folder to the list of pending paths to allow for recursive inclusion.
private addFileModels ( FilesModel[] $files, array $skipPaths = [] ) : void
$files FilesModel[] The files to add.
$skipPaths array List of directories not to be added to the list of pending directories.
return void
    private function addFileModels($files, $skipPaths = array())
    {
        $baseLanguage = $this->getBaseLanguage();
        $fallbackLanguage = $this->getFallbackLanguage();
        foreach ($files as $file) {
            if ('folder' === $file->type && !in_array($file->path, $skipPaths)) {
                $this->pendingPaths[] = $file->path . '/';
                continue;
            }
            if (is_file(TL_ROOT . DIRECTORY_SEPARATOR . $file->path) && in_array(strtolower(pathinfo($file->path, PATHINFO_EXTENSION)), $this->acceptedExtensions)) {
                $path = $file->path;
                $this->foundFiles[] = $path;
                $this->uuidMap[$file->uuid] = $path;
                $meta = deserialize($file->meta, true);
                if (isset($meta[$baseLanguage])) {
                    $this->metaInformation[dirname($path)][basename($path)] = $meta[$baseLanguage];
                } elseif (isset($meta[$fallbackLanguage])) {
                    $this->metaInformation[dirname($path)][basename($path)] = $meta[$fallbackLanguage];
                }
            }
        }
    }