A simple object storage class that will only allow "supported" objects.
class MyObjectStorage extendsHerrera\Util\ObjectStorage
{
publicfunctionisSupported($object)
{
return ($objectinstanceofPDO);
}
}
$store = newMyObjectStorage();
$pdo = newPDO('dsn...');
$time = newDateTime();
$store->attach($pdo);
$store->attach($time); // throws "UnexpectedValueException"