Resource
in package
implements
ResourceInterface
Description of Resource
Tags
Table of Contents
Interfaces
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
$client
private
static Client
$client
$config
private
object
$config
$defaultHandler
private
HandlerInterface
$defaultHandler
$handlers
private
array<string|int, HandlerInterface>
$handlers
= []
$meta
private
ResourceMeta
$meta
$pdo
private
PDO
$pdo
$url
private
string
$url
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>>getMeta()
Returns resource's basic metadata (URL, mime type, size, modification date, etc.)
public
getMeta() : ResourceMeta
Return values
ResourceMetagetResourcePath()
Returns path to the file storing a repository resource payload.
public
getResourcePath() : string
Return values
stringgetThumbnail()
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
stringgetThumbnailPath()
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
Return values
stringfetchResourceFile()
Fetches original resource
private
fetchResourceFile() : string
Tags
Return values
stringgetFilePath()
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
stringmaintainDb()
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