1
0
mirror of https://github.com/php/phd.git synced 2026-03-24 07:02:07 +01:00
Files
archived-phd/phpdotnet/phd/ObjectStorage.php

30 lines
574 B
PHP

<?php
namespace phpdotnet\phd;
/* $Id$ */
class ObjectStorage extends \SplObjectStorage
{
public function attach($obj, $inf = array()) {
if (!($obj instanceof Format)) {
throw new InvalidArgumentException(
'Only classess inheriting ' . __NAMESPACE__ . '\\Format supported'
);
}
if (empty($inf)) {
$inf = array(
\XMLReader::ELEMENT => $obj->getElementMap(),
\XMLReader::TEXT => $obj->getTextMap(),
);
}
parent::attach($obj, $inf);
return $obj;
}
}
/*
* vim600: sw=4 ts=4 syntax=php et
* vim<600: sw=4 ts=4
*/