Documentation

Resource
in package
implements ResourceInterface

Description of Resource

Tags
author

zozlak

Table of Contents

Interfaces

ResourceInterface

Properties

$client  : Client
$config  : object
$defaultHandler  : HandlerInterface
$handlers  : array<string|int, HandlerInterface>
$meta  : ResourceMeta
$pdo  : PDO
$url  : string

Methods

__construct()  : mixed
getCachedFiles()  : array<string, array<string|int, string>>
List cached files for a given resource.
getMeta()  : ResourceMeta
Returns resource's basic metadata (URL, mime type, size, modification date, etc.)
getResourcePath()  : string
Returns path to the file storing a repository resource payload.
getThumbnail()  : string
Returns path to the resource thumbnail in a given dimensions.
getThumbnailPath()  : string
Gets path to an already cached resource thumbnail of a given dimensions.
fetchResourceFile()  : string
Fetches original resource
getFilePath()  : string
Returns expected cached file location (but doesn't assure such a file exists).
maintainDb()  : void
Assures database contains all the tables
maintainMetadataCache()  : void
Fetches resource's metadata into $this->meta (from the database or, when needed, from the repository)
resolveUrl()  : string

Properties

Methods

__construct()

public __construct(string $id, object $config) : mixed
Parameters
$id : string
$config : object

getCachedFiles()

List cached files for a given resource.

public getCachedFiles(int $order) : array<string, array<string|int, string>>

Returnes 2D array with first dimension indicating available widths and second dimension listing heights available for a given width. Both dimensions are encoded as strings left-padded with zeros up to 5 digits length.

Parameters
$order : int

\SCANDIR_SORT_ASCENDING or SCANDIR_SORT_DESCENDING

Return values
array<string, array<string|int, string>>

getResourcePath()

Returns path to the file storing a repository resource payload.

public getResourcePath() : string
Return values
string

getThumbnail()

Returns path to the resource thumbnail in a given dimensions.

public getThumbnail([int $width = 0 ][, int $height = 0 ]) : string

Always returns a proper path.

Parameters
$width : int = 0
$height : int = 0
Return values
string

getThumbnailPath()

Gets path to an already cached resource thumbnail of a given dimensions.

public getThumbnailPath([int $width = 0 ][, int $height = 0 ]) : string

If $width and $height are not specified, returns path to the original resource file.

If the thumbnail of a given dimensions is not yet cached, a \acdhOeaw\arche\thumbnails\NoSuchFileException exception is thrown but the resource in original dimensions can be assumed to be always available.

Parameters
$width : int = 0
$height : int = 0
Tags
throws
NoSuchFileException
Return values
string

getFilePath()

Returns expected cached file location (but doesn't assure such a file exists).

private getFilePath([int $width = 0 ][, int $height = 0 ]) : string

If $width or $height are not specified, returns path to the original reference file.

Parameters
$width : int = 0
$height : int = 0
Return values
string

maintainDb()

Assures database contains all the tables

private maintainDb() : void

maintainMetadataCache()

Fetches resource's metadata into $this->meta (from the database or, when needed, from the repository)

private maintainMetadataCache() : void

resolveUrl()

private static resolveUrl(string $url) : string
Parameters
$url : string
Return values
string

        
On this page

Search results