AbstractDriver implements DriverInterface

AbstractYes

An abstract implementation of a storage driver.

Table of Contents

Interfaces

DriverInterface
An interface Drivers have to implement to fulfil the needs of the FAL API.

Properties

$capabilities  : Capabilities
The capabilities of this driver. This value should be set in the constructor of derived classes.
$configuration  : array<string|int, mixed>
The configuration of this driver
$storageUid  : int|null
The storage uid the driver was instantiated for
$supportedHashAlgorithms  : array<string|int, mixed>
A list of all supported hash algorithms, written all lower case and without any dashes etc. (e.g. sha1 instead of SHA-1) Be sure to set this in inherited classes!

Methods

__construct()  : mixed
Creates this object.
getCapabilities()  : Capabilities
Returns the capabilities of this driver.
hasCapability()  : bool
Returns TRUE if this driver has the given capability.
hashIdentifier()  : non-empty-string
Hashes a file identifier, taking the case sensitivity of the file system into account. This helps mitigating problems with case-insensitive databases.
isCaseSensitiveFileSystem()  : bool
Returns TRUE if this driver uses case-sensitive identifiers. NOTE: This is a configurable setting, but the setting does not change the way the underlying file system treats the identifiers; the setting should therefore always reflect the file system and not try to change its behaviour
setStorageUid()  : void
Sets the storage uid the driver belongs to
canonicalizeAndCheckFileIdentifier()  : string
Makes sure the identifier given as parameter is valid
canonicalizeAndCheckFilePath()  : string
Makes sure the path given as parameter is valid
canonicalizeAndCheckFolderIdentifier()  : string
Makes sure the identifier given as parameter is valid
getTemporaryPathForFile()  : string
Returns a temporary path for a given file, including the file extension.
isValidFilename()  : bool
Checks a fileName for validity. This could be overridden in concrete drivers if they have different file naming rules.

Properties

$capabilities

The capabilities of this driver. This value should be set in the constructor of derived classes.

protected Capabilities $capabilities

$configuration

The configuration of this driver

protected array<string|int, mixed> $configuration = []

$storageUid

The storage uid the driver was instantiated for

protected int|null $storageUid = null

$supportedHashAlgorithms

A list of all supported hash algorithms, written all lower case and without any dashes etc. (e.g. sha1 instead of SHA-1) Be sure to set this in inherited classes!

protected array<string|int, mixed> $supportedHashAlgorithms = []
Tags
phpstan-var

list

todo:

Remove this from this class. Properties of abstract classes MUST NOT be api. If all drivers need to implement this, consider creating a new method stub in the DriverInterface or consider creating a new SupportedHashAlgorithmsAwareInterface that demands implementations to provide said information. Inside this abstract class, this property is useless, however.

Methods

__construct()

Creates this object.

public __construct([array<string|int, mixed> $configuration = [] ]) : mixed
Parameters
$configuration : array<string|int, mixed> = []

hasCapability()

Returns TRUE if this driver has the given capability.

public hasCapability(int $capability) : bool
Parameters
$capability : int
Tags
phpstan-param

Capabilities::CAPABILITY_* $capability

Return values
bool

hashIdentifier()

Hashes a file identifier, taking the case sensitivity of the file system into account. This helps mitigating problems with case-insensitive databases.

public hashIdentifier(string $identifier) : non-empty-string
Parameters
$identifier : string
Tags
phpstan-param

non-empty-string $identifier

phpstan-return

non-empty-string

Return values
non-empty-string

isCaseSensitiveFileSystem()

Returns TRUE if this driver uses case-sensitive identifiers. NOTE: This is a configurable setting, but the setting does not change the way the underlying file system treats the identifiers; the setting should therefore always reflect the file system and not try to change its behaviour

public isCaseSensitiveFileSystem() : bool
Return values
bool

setStorageUid()

Sets the storage uid the driver belongs to

public setStorageUid(int $storageUid) : void
Parameters
$storageUid : int

canonicalizeAndCheckFileIdentifier()

Makes sure the identifier given as parameter is valid

protected abstract canonicalizeAndCheckFileIdentifier(string $fileIdentifier) : string
Parameters
$fileIdentifier : string
Tags
phpstan-param

non-empty-string $fileIdentifier The file Identifier

phpstan-return

non-empty-string

Return values
string

canonicalizeAndCheckFilePath()

Makes sure the path given as parameter is valid

protected abstract canonicalizeAndCheckFilePath(string $filePath) : string
Parameters
$filePath : string
Tags
phpstan-param

non-empty-string $filePath The file path (most times filePath)

phpstan-return

non-empty-string

Return values
string

canonicalizeAndCheckFolderIdentifier()

Makes sure the identifier given as parameter is valid

protected abstract canonicalizeAndCheckFolderIdentifier(string $folderIdentifier) : string
Parameters
$folderIdentifier : string
Tags
phpstan-param

non-empty-string $folderIdentifier The folder identifier

phpstan-return

non-empty-string

Return values
string

getTemporaryPathForFile()

Returns a temporary path for a given file, including the file extension.

protected getTemporaryPathForFile(string $fileIdentifier) : string
Parameters
$fileIdentifier : string
Tags
phpstan-param

non-empty-string $fileIdentifier

phpstan-return

non-empty-string

Return values
string

isValidFilename()

Checks a fileName for validity. This could be overridden in concrete drivers if they have different file naming rules.

protected isValidFilename(string $fileName) : bool
Parameters
$fileName : string
Return values
bool

        
On this page

Search results