\Klutz_Driver

Klutz_Driver:: defines an API for storing and retrieving the comic images

Summary

Methods
Properties
Constants
factory()
listDates()
imageSize()
imageExists()
storeImage()
retrieveImage()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

factory()

factory(string  $driver = null, array  $params = null) : object

Gets a concrete Klutz_Driver instance.

Parameters

string $driver

The type of concrete Klutz_Driver subclass to return. The code for the driver is dynamically included.

array $params

A hash containing any additional configuration or connection parameters a subclass might need

Returns

object —

Klutz_Driver The newly created concrete instance, or false on error.

listDates()

listDates(\timestamp  $date = null, \timestamp  $oldest = null, \timestamp  $newest = null) : array

Gets a list of the dates for which we have comics between $oldest and $newest. In the default driver (no backend) this is just a list of all dates between $oldest and $newest.

Parameters

\timestamp $date

The reference date (default today)

\timestamp $oldest

The earliest possible date to return (default first of the month)

\timestamp $newest

The latest possible date to return (default last date of the month)

Returns

array —

timestamps Dates between $oldest and $newest we have comics for

imageSize()

imageSize(string  $index, \timestamp  $date = null) : string

Get the image dimensions for the requested image.

The image is not stored locally so this function returns an empty string. Performance hit is too expensive to make this worth it.

Parameters

string $index

The index of the comic to check

\timestamp $date

The date of the comic to check (default today)

Returns

string —

Attributes for an tag giving height and width

imageExists()

imageExists(string  $index, \timestamp  $date = null) : boolean

Find out if we already have a local copy of this image.

Even though we never actually store a local copy, pretend.

Parameters

string $index

The index of the comic to check

\timestamp $date

The date of the comic to check (default today)

Returns

boolean —

True

storeImage()

storeImage(string  $index, string  $image,   $date = null) : boolean

Store an image for later retrieval

Even though we never actually store a local copy, pretend.

Parameters

string $index

The index of the comic to retrieve

string $image

Raw (binary) image data to store

$date

Returns

boolean —

True

retrieveImage()

retrieveImage(string  $index, \timestamp  $date = null) : mixed

Retrieve an image from storage. Since there is no local storage this will actually call for the fetching.

Parameters

string $index

The index of the comic to retrieve

\timestamp $date

The date for which we want $comic

Returns

mixed —

If the image exists locally, return a Klutz_Image object. If it doesn't, return a string with the URL pointing to the comic.