Register style can be skipped when already registered

This commit is contained in:
Antoine Lamirault committed 2021-02-22 20:47:32 +01:00
1 parent 40bdc9c0f1
commit f109432880
9 files changed
+84 -31

No files matched your search

@@ -38,7 +38,7 @@ class StyleRegistry
if (!$this->hasSerializedStyleAlreadyBeenRegistered($serializedStyle)) {
$nextStyleId = \count($this->serializedStyleToStyleIdMappingTable);
$style->setId($nextStyleId);
$style->register($nextStyleId);
$this->serializedStyleToStyleIdMappingTable[$serializedStyle] = $nextStyleId;
$this->styleIdToStyleMappingTable[$nextStyleId] = $style;
@@ -112,9 +112,10 @@ class StyleRegistry
*/
public function serialize(Style $style)
{
// In order to be able to properly compare style, set static ID value
// In order to be able to properly compare style, set static ID value and reset registration
$currentId = $style->getId();
$style->setId(0);
$style->setRegistered(false);
$serializedStyle = \serialize($style);