Code Duplication    Length = 11-19 lines in 2 locations

eZ/Publish/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php 1 location

@@ 114-124 (lines=11) @@
111
        }
112
    }
113
114
    public function onUpdateContentMetadata(UpdateContentMetadataEvent $event)
115
    {
116
        $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($event->getContent()->id);
117
        if (!$contentInfo->isPublished) {
118
            return;
119
        }
120
        $this->searchHandler->indexContent(
121
            $this->persistenceHandler->contentHandler()->load($contentInfo->id, $contentInfo->currentVersionNo)
122
        );
123
        $this->searchHandler->indexLocation($this->persistenceHandler->locationHandler()->load($contentInfo->mainLocationId));
124
    }
125
}
126

eZ/Publish/Core/Search/Common/EventSubscriber/LocationEventSubscriber.php 1 location

@@ 101-119 (lines=19) @@
98
        $this->indexSubtree($event->getRevealedLocation()->id);
99
    }
100
101
    public function onUpdateLocation(UpdateLocationEvent $event)
102
    {
103
        $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo(
104
            $event->getLocation()->contentId
105
        );
106
107
        $this->searchHandler->indexContent(
108
            $this->persistenceHandler->contentHandler()->load(
109
                $event->getLocation()->contentId,
110
                $contentInfo->currentVersionNo
111
            )
112
        );
113
114
        $this->searchHandler->indexLocation(
115
            $this->persistenceHandler->locationHandler()->load(
116
                $event->getLocation()->id
117
            )
118
        );
119
    }
120
}
121