interface FileIDHelper (View source)

Helps build and parse Filename Identifiers (ake: FileIDs) according to a predefined format.

Methods

public
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

public
string
cleanFilename(string $filename)

Clean up filename to remove constructs that might clash with the underlying path format of this FileIDHelper.

public
parseFileID(string $fileID)

Get Filename, Variant and Hash from a fileID. If a FileID can not be parsed, returns null.

public
bool
isVariantOf(string $fileID, ParsedFileID $parsedFileID)

Determine if the provided fileID is a variant of $parsedFileID.

public
string
lookForVariantIn(ParsedFileID $parsedFileID)

Compute the relative path where variants of the provided parsed file ID are expected to be stored.

public
bool
lookForVariantRecursive()

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

Parameters

string|ParsedFileID $filename

Name of file or ParsedFileID object

string $hash

Hash of original file

string $variant

(if given)

bool $cleanfilename

Whether the filename should be cleaned before building the file ID. Defaults to true.

Return Value

string

Adapter specific identifier for this file/version

string cleanFilename(string $filename)

Clean up filename to remove constructs that might clash with the underlying path format of this FileIDHelper.

Parameters

string $filename

Return Value

string

ParsedFileID|null parseFileID(string $fileID)

Get Filename, Variant and Hash from a fileID. If a FileID can not be parsed, returns null.

Parameters

string $fileID

Return Value

ParsedFileID|null

bool isVariantOf(string $fileID, ParsedFileID $parsedFileID)

Determine if the provided fileID is a variant of $parsedFileID.

Parameters

string $fileID
ParsedFileID $parsedFileID

Return Value

bool

string lookForVariantIn(ParsedFileID $parsedFileID)

Compute the relative path where variants of the provided parsed file ID are expected to be stored.

Parameters

ParsedFileID $parsedFileID

Return Value

string

bool lookForVariantRecursive()

Specify if this File ID Helper stores variants in subfolders and require a recursive look up to find all variants.

Return Value

bool