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

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