mirror of
https://github.com/php/phd.git
synced 2026-03-24 07:02:07 +01:00
24 lines
526 B
PHP
24 lines
526 B
PHP
<?php
|
|
namespace phpdotnet\phd;
|
|
|
|
class ObjectStorage extends \SplObjectStorage
|
|
{
|
|
public function attach(object $object, mixed $info = array()): void {
|
|
if (!($object instanceof Format)) {
|
|
throw new \InvalidArgumentException(
|
|
'Only classess inheriting ' . __NAMESPACE__ . '\\Format supported'
|
|
);
|
|
}
|
|
if (empty($info)) {
|
|
$info = array(
|
|
\XMLReader::ELEMENT => $object->getElementMap(),
|
|
\XMLReader::TEXT => $object->getTextMap(),
|
|
);
|
|
}
|
|
parent::attach($object, $info);
|
|
}
|
|
}
|
|
|
|
|
|
|