FileIDHelper
interface FileIDHelper (View source)
Helps build and parse Filename Identifiers (ake: FileIDs) according to a predefined format.
Methods
Map file tuple (hash, name, variant) to a filename to be used by flysystem
Clean up filename to remove constructs that might clash with the underlying path format of this FileIDHelper.
Get Filename, Variant and Hash from a fileID. If a FileID can not be parsed, returns null
.
Determine if the provided fileID is a variant of $parsedFileID
.
Compute the relative path where variants of the provided parsed file ID are expected to be stored.
Specify if this File ID Helper stores variants in subfolders and require a recursive look up to find all variants.
Details
string
buildFileID(string|ParsedFileID $filename, string $hash = null, string $variant = null, bool $cleanfilename = true)
Map file tuple (hash, name, variant) to a filename to be used by flysystem
string
cleanFilename(string $filename)
Clean up filename to remove constructs that might clash with the underlying path format of this FileIDHelper.
ParsedFileID|null
parseFileID(string $fileID)
Get Filename, Variant and Hash from a fileID. If a FileID can not be parsed, returns null
.
bool
isVariantOf(string $fileID, ParsedFileID $parsedFileID)
Determine if the provided fileID is a variant of $parsedFileID
.
string
lookForVariantIn(ParsedFileID $parsedFileID)
Compute the relative path where variants of the provided parsed file ID are expected to be stored.
bool
lookForVariantRecursive()
Specify if this File ID Helper stores variants in subfolders and require a recursive look up to find all variants.