kherge-archive / php-object-storage

An object store for specific objects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Object Storage

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

About

An object store for specific objects.

License:MIT License


Languages

Language:PHP 100.0%