FileInterface extends ResourceInterface
File Interface
Table of Contents
Methods
- delete() : bool
- Deletes this file from its storage. This also means that this object becomes useless.
- getContents() : string
- Get the contents of this file
- getCreationTime() : int
- Returns the creation time of the file as Unix timestamp
- getExtension() : string
- Get the file extension
- getForLocalProcessing() : non-empty-string
- Returns a path to a local version of this file to process it locally (e.g. with some system tool).
- getHashedIdentifier() : non-empty-string
- getIdentifier() : string
- getMimeType() : non-empty-string
- Get the MIME type of this file
- getModificationTime() : int
- Returns the modification time of the file as Unix timestamp
- getName() : string
- getNameWithoutExtension() : string
- Returns the basename (the name without extension) of this file.
- getParentFolder() : FolderInterface
- getProperty() : mixed
- Get the value of the $key property.
- getPublicUrl() : non-empty-string|null
- Returns a publicly accessible URL for this file
- getSha1() : non-empty-string
- Returns the Sha1 of this file
- getSize() : int<0, max>
- MUST return the size of the file as unsigned int i.e. 0-max.
- getStorage() : ResourceStorage
- hasProperty() : bool
- Returns true if the given key exists for this file.
- isIndexed() : bool
- Returns TRUE if this file is indexed
- rename() : FileInterface
- Renames this file.
- setContents() : $this
- Replace the current file contents with the given string.
- toArray() : array<string, mixed>
- Returns an array representation of the file.
Methods
delete()
Deletes this file from its storage. This also means that this object becomes useless.
public
delete() : bool
Return values
boolgetContents()
Get the contents of this file
public
getContents() : string
Return values
stringgetCreationTime()
Returns the creation time of the file as Unix timestamp
public
getCreationTime() : int
Return values
intgetExtension()
Get the file extension
public
getExtension() : string
Return values
stringgetForLocalProcessing()
Returns a path to a local version of this file to process it locally (e.g. with some system tool).
public
getForLocalProcessing([bool $writable = true ]) : non-empty-string
If the file is normally located on a remote storages, this creates a local copy. If the file is already on the local system, this only makes a new copy if $writable is set to TRUE.
Parameters
- $writable : bool = true
-
Set this to FALSE if you only want to do read operations on the file.
Return values
non-empty-stringgetHashedIdentifier()
public
getHashedIdentifier() : non-empty-string
Return values
non-empty-stringgetIdentifier()
public
getIdentifier() : string
Return values
stringgetMimeType()
Get the MIME type of this file
public
getMimeType() : non-empty-string
Return values
non-empty-string —mime type
getModificationTime()
Returns the modification time of the file as Unix timestamp
public
getModificationTime() : int
Return values
intgetName()
public
getName() : string
Return values
stringgetNameWithoutExtension()
Returns the basename (the name without extension) of this file.
public
getNameWithoutExtension() : string
Return values
stringgetParentFolder()
public
getParentFolder() : FolderInterface
Return values
FolderInterfacegetProperty()
Get the value of the $key property.
public
getProperty(non-empty-string $key) : mixed
Parameters
- $key : non-empty-string
getPublicUrl()
Returns a publicly accessible URL for this file
public
getPublicUrl() : non-empty-string|null
WARNING: Access to the file may be restricted by further means, e.g. some web-based authentication. You have to take care of this yourself.
Return values
non-empty-string|null —NULL if file is missing or deleted, the generated url otherwise
getSha1()
Returns the Sha1 of this file
public
getSha1() : non-empty-string
Return values
non-empty-stringgetSize()
MUST return the size of the file as unsigned int i.e. 0-max.
public
getSize() : int<0, max>
In case of errors, e.g. when the file is deleted or not readable, this method MAY either throw an Exception or return 0.
Return values
int<0, max>getStorage()
public
getStorage() : ResourceStorage
Return values
ResourceStoragehasProperty()
Returns true if the given key exists for this file.
public
hasProperty(non-empty-string $key) : bool
Parameters
- $key : non-empty-string
Return values
boolisIndexed()
Returns TRUE if this file is indexed
public
isIndexed() : bool
Return values
boolrename()
Renames this file.
public
rename(non-empty-string $newName[, DuplicationBehavior $conflictMode = DuplicationBehavior::RENAME ]) : FileInterface
Parameters
- $newName : non-empty-string
-
The new file name
- $conflictMode : DuplicationBehavior = DuplicationBehavior::RENAME
Return values
FileInterfacesetContents()
Replace the current file contents with the given string.
public
setContents(string $contents) : $this
Parameters
- $contents : string
Tags
Return values
$thistoArray()
Returns an array representation of the file.
public
toArray() : array<string, mixed>
(This is used by the generic listing module vidi when displaying file records.)
Return values
array<string, mixed> —Array of main data of the file. Don't rely on all data to be present here, it's just a selection of the most relevant information.