Documentation

SimpleStorage extends AbstractFilesystemStorage
in package

Class SimpleStorage

Table of Contents

Properties

$caseSensitive  : bool
$data  : array<string|int, mixed>|null
$dataFolder  : string
$dataFormatter  : FileFormatterInterface
$dataPattern  : string
$keyField  : string
$keyLen  : int
$modified  : int
$prefix  : string|null

Methods

__construct()  : mixed
StorageInterface constructor.
buildStorageKey()  : string
buildStorageKeyParams()  : string
clearCache()  : void
copyRow()  : bool
createRows()  : array<string|int, mixed>
Create new rows into the storage.
deleteRows()  : array<string|int, mixed>
Delete rows from the storage.
extractKeysFromRow()  : array<string|int, mixed>
extractKeysFromStorageKey()  : array<string|int, mixed>
getExistingKeys()  : array<string|int, mixed>
Returns associated array of all existing storage keys with a timestamp.
getKeyField()  : string
getMediaPath()  : string|null
Get filesystem path for the collection or object media.
getMetaData()  : array<string|int, mixed>
getStoragePath()  : string|null
Get filesystem path for the collection or object storage.
hasKey()  : bool
Check if the key exists in the storage.
hasKeys()  : array<string|int, bool>
Check if the key exists in the storage.
isIndexed()  : bool
normalizeKey()  : string
parseKey()  : array<string|int, mixed>
readRows()  : array<string|int, mixed>
Read rows from the storage.
renameRow()  : bool
replaceRows()  : array<string|int, mixed>
Replace rows regardless if they exist or not.
updateRows()  : array<string|int, mixed>
Update existing rows in the storage.
buildIndex()  : array<string|int, mixed>
Returns list of all stored keys in [key => timestamp] pairs.
detectDataFormatter()  : string|null
generateKey()  : string
Generates a random, unique key for the row.
getFile()  : CompiledJsonFile|CompiledYamlFile|CompiledMarkdownFile
getKeyFromPath()  : string
Get key from the filesystem path.
getNewKey()  : string
getObjectMeta()  : array<string|int, mixed>
initDataFormatter()  : void
loadRow()  : array<string|int, mixed>
prepareRow()  : void
Prepares the row for saving and returns the storage key for the record.
resolvePath()  : string
save()  : void
saveRow()  : array<string|int, mixed>
validateKey()  : bool
Checks if a key is valid.

Properties

Methods

__construct()

StorageInterface constructor.

public __construct(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>
Tags
see
FlexStorageInterface::__construct()

buildStorageKey()

public buildStorageKey(array<string|int, mixed> $keys[, bool $includeParams = true ]) : string
Parameters
$keys : array<string|int, mixed>
$includeParams : bool = true
Return values
string

buildStorageKeyParams()

public buildStorageKeyParams(array<string|int, mixed> $keys) : string
Parameters
$keys : array<string|int, mixed>
Return values
string

copyRow()

public copyRow(string $src, string $dst) : bool
Parameters
$src : string
$dst : string
Return values
bool

createRows()

Create new rows into the storage.

public createRows(array<string|int, mixed> $rows) : array<string|int, mixed>
Parameters
$rows : array<string|int, mixed>

List of rows as [row, ...].

Tags
see
FlexStorageInterface::createRows()
Return values
array<string|int, mixed>

Returns created rows as `[key => row, ...] pairs.

deleteRows()

Delete rows from the storage.

public deleteRows(array<string|int, mixed> $rows) : array<string|int, mixed>
Parameters
$rows : array<string|int, mixed>

Array of [key => row, ...] pairs.

Tags
see
FlexStorageInterface::deleteRows()
Return values
array<string|int, mixed>

Returns deleted rows. Note that non-existing rows have null as their value.

extractKeysFromRow()

public extractKeysFromRow(array<string|int, mixed> $row) : array<string|int, mixed>
Parameters
$row : array<string|int, mixed>
Return values
array<string|int, mixed>

extractKeysFromStorageKey()

public extractKeysFromStorageKey(string $key) : array<string|int, mixed>
Parameters
$key : string
Return values
array<string|int, mixed>

getExistingKeys()

Returns associated array of all existing storage keys with a timestamp.

public getExistingKeys() : array<string|int, mixed>
Tags
see
FlexStorageInterface::getExistingKeys()
Return values
array<string|int, mixed>

Returns all existing keys as [key => [storage_key => key, storage_timestamp => timestamp], ...].

getMediaPath()

Get filesystem path for the collection or object media.

public getMediaPath([string $key = null ]) : string|null
Parameters
$key : string = null

Optional storage key.

Tags
see
FlexStorageInterface::getMediaPath()
Return values
string|null

Path in the filesystem. Can be URI or null if media isn't supported.

getMetaData()

public getMetaData(array<string|int, string> $keys[, bool $reload = false ]) : array<string|int, mixed>
Parameters
$keys : array<string|int, string>
$reload : bool = false
Return values
array<string|int, mixed>

getStoragePath()

Get filesystem path for the collection or object storage.

public getStoragePath([string $key = null ]) : string|null
Parameters
$key : string = null

Optional storage key.

Tags
see
FlexStorageInterface::getStoragePath()
Return values
string|null

Path in the filesystem. Can be URI or null if storage is not filesystem based.

hasKey()

Check if the key exists in the storage.

public hasKey(string $key) : bool
Parameters
$key : string

Storage key of an object.

Tags
see
FlexStorageInterface::hasKey()
Return values
bool

Returns true if the key exists in the storage, false otherwise.

hasKeys()

Check if the key exists in the storage.

public hasKeys(array<string|int, mixed> $keys) : array<string|int, bool>
Parameters
$keys : array<string|int, mixed>

Storage key of an object.

Tags
see
FlexStorageInterface::hasKeys()
Return values
array<string|int, bool>

Returns keys with true if the key exists in the storage, false otherwise.

parseKey()

public parseKey(string $key[, bool $variations = true ]) : array<string|int, mixed>
Parameters
$key : string
$variations : bool = true
Return values
array<string|int, mixed>

readRows()

Read rows from the storage.

public readRows(array<string|int, mixed> $rows[, array<string|int, mixed> &$fetched = null ]) : array<string|int, mixed>
Parameters
$rows : array<string|int, mixed>

Array of [key => row, ...] pairs.

$fetched : array<string|int, mixed> = null

Optional reference to store only fetched items.

Tags
see
FlexStorageInterface::readRows()
Return values
array<string|int, mixed>

Returns rows. Note that non-existing rows will have null as their value.

renameRow()

public renameRow(string $src, string $dst) : bool
Parameters
$src : string
$dst : string
Tags
see
FlexStorageInterface::renameRow()
Return values
bool

replaceRows()

Replace rows regardless if they exist or not.

public replaceRows(array<string|int, mixed> $rows) : array<string|int, mixed>
Parameters
$rows : array<string|int, mixed>

Array of [key => row, ...] pairs.

Tags
see
FlexStorageInterface::replaceRows()
Return values
array<string|int, mixed>

Returns both created and updated rows.

updateRows()

Update existing rows in the storage.

public updateRows(array<string|int, mixed> $rows) : array<string|int, mixed>
Parameters
$rows : array<string|int, mixed>

Array of [key => row, ...] pairs.

Tags
see
FlexStorageInterface::updateRows()
Return values
array<string|int, mixed>

Returns updated rows. Note that non-existing rows will not be saved and have null as their value.

buildIndex()

Returns list of all stored keys in [key => timestamp] pairs.

protected buildIndex() : array<string|int, mixed>
Return values
array<string|int, mixed>

detectDataFormatter()

protected detectDataFormatter(string $filename) : string|null
Parameters
$filename : string
Return values
string|null

generateKey()

Generates a random, unique key for the row.

protected generateKey() : string
Return values
string

getKeyFromPath()

Get key from the filesystem path.

protected getKeyFromPath(string $path) : string
Parameters
$path : string
Return values
string

getNewKey()

protected getNewKey() : string
Return values
string

getObjectMeta()

protected getObjectMeta(string $key[, bool $reload = false ]) : array<string|int, mixed>
Parameters
$key : string
$reload : bool = false
Return values
array<string|int, mixed>

initDataFormatter()

protected initDataFormatter(string|array<string|int, mixed> $formatter) : void
Parameters
$formatter : string|array<string|int, mixed>

loadRow()

protected loadRow(string $key) : array<string|int, mixed>
Parameters
$key : string
Return values
array<string|int, mixed>

prepareRow()

Prepares the row for saving and returns the storage key for the record.

protected prepareRow(array<string|int, mixed> &$row) : void
Parameters
$row : array<string|int, mixed>

saveRow()

protected saveRow(string $key, array<string|int, mixed> $row) : array<string|int, mixed>
Parameters
$key : string
$row : array<string|int, mixed>
Return values
array<string|int, mixed>

validateKey()

Checks if a key is valid.

protected validateKey(string $key) : bool
Parameters
$key : string
Return values
bool

        
On this page

Search results