mirror of
https://github.com/php/phd.git
synced 2026-04-28 09:23:21 +02:00
b0e35d28db
Signed-off-by: Moacir de Oliveira <moacir@php.net>
30 lines
575 B
PHP
30 lines
575 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
|
|
*/
|
|
|