Returns the list of files in the stack, filtered by type (if given).

@param string[] $types Filter files by type. Valid types: "image", "document", "other"

@return FileInterface[]
542434
public function getList(array $types = [])
    {
        $this->initialize();

        if (empty($types)) {
            return $this->files;
        }

        $images = in_array('image', $types);
        $docs = in_array('document', $types);
        $other = in_array('other', $types);
        $files = array_filter($this->files, function (FileInterface $file) use ($images, $docs, $other) {
            switch ($file->getType()) {
                case 'image':
                    return $images;
                case 'document':
                    return $docs;
                default:
                    return $other;
            }
        });
        $files = array_values($files); // normalize indexes

        return $files;
    }
221561
public static function get_files_to_publish($type = null)
    {
        if (!isset(static::$publishes[ static::class ])) {
            return [];
        }

        if ($type !== null) {
            return static::$publishes[ static::class ][ $type ];
        }

        $iterator = new RecursiveIteratorIterator(
            new RecursiveArrayIterator(static::$publishes[ static::class ])
        );

        return \iterator_to_array($iterator);
    }
132380
protected function types(array $types): array
    {
        $results = [];
        foreach ($types as $type)
        {
            $results[] = $this->types[$type];
        }

        return $results;
    }
668543
private function serializeTypes(TypeCollection $types)
    {
        $typesData = [];
        /** @var Type $type */
        foreach ($types as $type) {
            $typesData[] = $type->getType();
        }

        return $typesData;
    }
404214
protected function _getFileData($_files) {
		$return_files = [];
		if (is_array($_files)) {
			foreach ($_files as $fkey => $fvalue) {
				if (is_array($fvalue)) {
					foreach ($fvalue as $varname => $varpair) {
						if (is_array($varpair)) {
							foreach ($varpair as $fieldname => $varvalue) {
								$return_files[$fkey][$fieldname][$varname]=$varvalue;
							}
						} else {
							$return_files[$fkey] = $fvalue;
						}
					}
				}
			}
		}
		return $return_files;
	}
1063661
private function getFiles(array $uploadedFiles)
    {
        $files = [];

        foreach ($uploadedFiles as $key => $value) {
            if ($value instanceof UploadedFileInterface) {
                $files[$key] = $this->createUploadedFile($value);
            } else {
                $files[$key] = $this->getFiles($value);
            }
        }

        return $files;
    }
48210
public function defaultTypes(array $types = null)
    {
        deprecationWarning(
            'TypeMapTrait::defaultTypes() is deprecated. ' .
            'Use TypeMapTrait::setDefaultTypes()/getDefaultTypes() instead.'
        );
        if ($types !== null) {
            return $this->setDefaultTypes($types);
        }

        return $this->getDefaultTypes();
    }
1362292
public function findFiles(FileNodeCollectionInterface $files)
    {
        return $files->filter(function (FileNode $file) {
            $metadata = $file->getMetadata();
            if ($metadata) {
                return ($this->filter->matches($file->getMetadata()));
            } else {
                return false;
            }
        });
    }
569282
public function getFiles()
    {
        $files = $this->files;

        foreach ($this->types as $type) {
            $files = array_merge($files, $type->getFiles());
        }
        
        $path = \Altamira\Config::getInstance()->getPluginPath( $this->getLibrary() );
        
        array_walk( $files, function( &$val ) use ( $path ) { $val = $path . $val; } ); 

        return $files;
    }
552789
private function getFilters($type)
    {
        $filters = [];
        if ('contao' === $type) {
            $filters[] =
                function ($package) {
                    /** @var PackageInterface $package */
                    return in_array($package->getType(), ['contao-module', 'contao-bundle', 'legacy-contao-module']);
                };
        }

        return $filters;
    }
678167
private function getMediaTypes()
    {
        $counter = 1;

        $types = [];
        $types[$counter++] = 'None';
        $types[$counter++] = 'File';
        $types[$counter++] = 'Image';
        $types[$counter++] = 'Video';

        return $types;
    }
1232652
private function doClear(array $types)
    {
        $cleared = [];
        $this->mf->enableCache(false);

        foreach ($types as $type) {
            $metadata = $this->mf->getMetadataForType($type);
            $this->mf->getCache()->evictMetadataFromCache($metadata);
            $cleared[] = $type;
        }

        $this->mf->enableCache(true);
        $this->mf->clearMemory();
        return $cleared;
    }
940598
private function resolveTypes($type)
    {
        $filterTypes = [];

        do {
            $filterTypes[] = $filterType = $this->filterRegistry[$type];
        } while (($type = $filterType->getParent()) !== null);

        return $filterTypes;
    }
867339
protected function getAllowedFields(string $type): array
    {
        \assert($this->hasFilter($type) === true);

        return $this->fieldSets[$type];
    }
174928
public function getFiles($extension = NULL) {

		$result = [];
		$glob = $this->path . '*';

		if(!is_null($extension)) {
			$glob .= ".$extension";
		}

		foreach(array_filter(glob($glob), 'is_file') as $f) {
			$result[] = FilesystemFile::getInstance($f, $this);
		}

		return $result;
	}
345434
public function loadFiles(array $files, $type = 'yaml')
    {
        $set = $this->createFixtureSet();
        foreach ($files as $file) {
            $set->addFile($file, $type);
        }
        $set->setDoPersist(false);

        return $this->load($set);
    }
428812
protected function filterFiles(array $files)
    {
        $files = parent::filterFiles($files);

        if (! class_exists('Illuminate\Http\UploadedFile')) {
            // The \Illuminate\Http\UploadedFile class was introduced in Laravel 5.2.15,
            // so don't change the $files array if it does not exist.
            return $files;
        }

        return $this->convertToTestFiles($files);
    }