herrera-io/object-storage

An object store for specific objects.

Installs: 163

Dependents: 3

Stars: 11

Watchers: 2

Forks: 1

Language: PHP

1.0.0 2013-06-19 18:44 UTC

README

Build Status

A simple object storage class that will only allow "supported" objects.

class MyObjectStorage extends Herrera\Util\ObjectStorage
{
    public function isSupported($object)
    {
        return ($object instanceof PDO);
    }
}

$store = new MyObjectStorage();
$pdo = new PDO('dsn...');
$time = new DateTime();

$store->attach($pdo);
$store->attach($time); // throws "UnexpectedValueException"

Documentation