$objects An array of object ids and their types */ public function __construct( private array $objects, ) { } /** * Get the object ids and their types. * * @return array */ public function getObjects(): array { return $this->objects; } public static function xmlDeserialize(Reader $reader) { $tree = $reader->parseInnerTree(); if ($tree === null) { return null; } $objects = []; foreach ($tree as $elem) { if ($elem['name'] === self::OBJECTID_ROOT_PROPERTYNAME) { $value = $elem['value']; $id = ''; $type = ''; foreach ($value as $subElem) { if ($subElem['name'] === self::OBJECTID_PROPERTYNAME) { $id = $subElem['value']; } elseif ($subElem['name'] === self::OBJECTTYPE_PROPERTYNAME) { $type = $subElem['value']; } } if ($id !== '' && $type !== '') { $objects[(string)$id] = (string)$type; } } } return new self($objects); } /** * The xmlSerialize method is called during xml writing. * * @param Writer $writer * @return void */ public function xmlSerialize(Writer $writer) { foreach ($this->objects as $objectsId => $type) { $writer->startElement(SystemTagPlugin::OBJECTIDS_PROPERTYNAME); $writer->writeElement(self::OBJECTID_PROPERTYNAME, $objectsId); $writer->writeElement(self::OBJECTTYPE_PROPERTYNAME, $type); $writer->endElement(); } } }