Code Duplication    Length = 19-27 lines in 2 locations

eZ/Publish/Core/Persistence/Cache/URLHandler.php 1 location

@@ 23-41 (lines=19) @@
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function updateUrl($id, URLUpdateStruct $struct)
24
    {
25
        $this->logger->logCall(__METHOD__, [
26
            'url' => $id,
27
            'struct' => $struct,
28
        ]);
29
30
        $url = $this->persistenceHandler->urlHandler()->updateUrl($id, $struct);
31
32
        $this->cache->invalidateTags(['url-' . $id]);
33
34
        if ($struct->url !== null) {
35
            $this->cache->invalidateTags(array_map(function ($id) {
36
                return 'content-' . $id;
37
            }, $this->persistenceHandler->urlHandler()->findUsages($id)));
38
        }
39
40
        return $url;
41
    }
42
43
    /**
44
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Cache/ContentHandler.php 1 location

@@ 243-269 (lines=27) @@
240
    /**
241
     * {@inheritdoc}
242
     */
243
    public function deleteContent($contentId)
244
    {
245
        $this->logger->logCall(__METHOD__, array('content' => $contentId));
246
247
        // Load reverse field relations first
248
        $reverseRelations = $this->persistenceHandler->contentHandler()->loadReverseRelations(
249
            $contentId,
250
            APIRelation::FIELD
251
        );
252
253
        $return = $this->persistenceHandler->contentHandler()->deleteContent($contentId);
254
255
        $this->cache->invalidateTags(['content-' . $contentId]);
256
        if (!empty($reverseRelations)) {
257
            $this->cache->invalidateTags(
258
                array_map(
259
                    function ($relation) {
260
                        // only the full content object *with* fields is affected by this
261
                        return 'content-fields-' . $relation->sourceContentId;
262
                    },
263
                    $reverseRelations
264
                )
265
            );
266
        }
267
268
        return $return;
269
    }
270
271
    /**
272
     * {@inheritdoc}