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
2024-10-21 15:19:45 +01:00

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);
}
}