Code Duplication    Length = 23-23 lines in 2 locations

eZ/Publish/Core/Persistence/Cache/TrashHandler.php 2 locations

@@ 43-65 (lines=23) @@
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function trashSubtree($locationId)
44
    {
45
        $this->logger->logCall(__METHOD__, array('locationId' => $locationId));
46
47
        $location = $this->persistenceHandler->locationHandler()->load($locationId);
48
        $reverseRelations = $this->persistenceHandler->contentHandler()->loadRelations($location->contentId);
49
50
        $return = $this->persistenceHandler->trashHandler()->trashSubtree($locationId);
51
52
        if (!empty($reverseRelations)) {
53
            $this->cache->invalidateTags(
54
                array_map(function (Relation $relation) {
55
                    return 'content-fields-' . $relation->destinationContentId;
56
                }, $reverseRelations)
57
            );
58
        }
59
60
        $this->cache->invalidateTags(['content-' . $location->contentId]);
61
        $this->cache->invalidateTags(['content-fields-' . $location->contentId]);
62
        $this->cache->invalidateTags(['location-' . $locationId, 'location-path-' . $locationId]);
63
64
        return $return;
65
    }
66
67
    /**
68
     * {@inheritdoc}
@@ 70-92 (lines=23) @@
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function recover($trashedId, $newParentId)
71
    {
72
        $this->logger->logCall(__METHOD__, array('id' => $trashedId, 'newParentId' => $newParentId));
73
74
        $return = $this->persistenceHandler->trashHandler()->recover($trashedId, $newParentId);
75
76
        $location = $this->persistenceHandler->locationHandler()->load($return);
77
        $reverseRelations = $this->persistenceHandler->contentHandler()->loadRelations($location->contentId);
78
79
        if (!empty($reverseRelations)) {
80
            $this->cache->invalidateTags(
81
                array_map(function (Relation $relation) {
82
                    return 'content-fields-' . $relation->destinationContentId;
83
                }, $reverseRelations)
84
            );
85
        }
86
87
        $this->cache->invalidateTags(['content-' . $location->contentId]);
88
        $this->cache->invalidateTags(['content-fields-' . $location->contentId]);
89
        $this->cache->invalidateTags(['location-' . $trashedId, 'location-path-' . $trashedId]);
90
91
        return $return;
92
    }
93
94
    /**
95
     * {@inheritdoc}