Code Duplication    Length = 11-14 lines in 10 locations

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

@@ 78-88 (lines=11) @@
75
    /**
76
     * {@inheritdoc}
77
     */
78
    public function loadContentInfo($contentId)
79
    {
80
        $cache = $this->cache->getItem('content', 'info', $contentId);
81
        $contentInfo = $cache->get();
82
        if ($cache->isMiss()) {
83
            $this->logger->logCall(__METHOD__, array('content' => $contentId));
84
            $cache->set($contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($contentId))->save();
85
        }
86
87
        return $contentInfo;
88
    }
89
90
    /**
91
     * {@inheritdoc}
@@ 93-103 (lines=11) @@
90
    /**
91
     * {@inheritdoc}
92
     */
93
    public function loadContentInfoByRemoteId($remoteId)
94
    {
95
        $cache = $this->cache->getItem('content', 'info', 'remoteId', $remoteId);
96
        $contentInfo = $cache->get();
97
        if ($cache->isMiss()) {
98
            $this->logger->logCall(__METHOD__, array('content' => $remoteId));
99
            $cache->set($contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfoByRemoteId($remoteId))->save();
100
        }
101
102
        return $contentInfo;
103
    }
104
105
    /**
106
     * {@inheritdoc}

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

@@ 48-58 (lines=11) @@
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function load($id)
49
    {
50
        $cache = $this->cache->getItem('language', $id);
51
        $language = $cache->get();
52
        if ($cache->isMiss()) {
53
            $this->logger->logCall(__METHOD__, array('language' => $id));
54
            $cache->set($language = $this->persistenceHandler->contentLanguageHandler()->load($id))->save();
55
        }
56
57
        return $language;
58
    }
59
60
    /**
61
     * {@inheritdoc}

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

@@ 72-82 (lines=11) @@
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function loadGroup($groupId)
73
    {
74
        $cache = $this->cache->getItem('contentTypeGroup', $groupId);
75
        $group = $cache->get();
76
        if ($cache->isMiss()) {
77
            $this->logger->logCall(__METHOD__, array('group' => $groupId));
78
            $cache->set($group = $this->persistenceHandler->contentTypeHandler()->loadGroup($groupId))->save();
79
        }
80
81
        return $group;
82
    }
83
84
    /**
85
     * {@inheritdoc}

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

@@ 24-34 (lines=11) @@
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function load($locationId)
25
    {
26
        $cache = $this->cache->getItem('location', $locationId);
27
        $location = $cache->get();
28
        if ($cache->isMiss()) {
29
            $this->logger->logCall(__METHOD__, array('location' => $locationId));
30
            $cache->set($location = $this->persistenceHandler->locationHandler()->load($locationId))->save();
31
        }
32
33
        return $location;
34
    }
35
36
    /**
37
     * {@inheritdoc}
@@ 39-52 (lines=14) @@
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function loadSubtreeIds($locationId)
40
    {
41
        $cache = $this->cache->getItem('location', 'subtree', $locationId);
42
        $locationIds = $cache->get();
43
44
        if ($cache->isMiss()) {
45
            $this->logger->logCall(__METHOD__, array('location' => $locationId));
46
            $cache->set(
47
                $locationIds = $this->persistenceHandler->locationHandler()->loadSubtreeIds($locationId)
48
            )->save();
49
        }
50
51
        return $locationIds;
52
    }
53
54
    /**
55
     * {@inheritdoc}

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

@@ 36-46 (lines=11) @@
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function loadGroup($groupId)
37
    {
38
        $cache = $this->cache->getItem('objectstategroup', $groupId);
39
        $group = $cache->get();
40
        if ($cache->isMiss()) {
41
            $this->logger->logCall(__METHOD__, array('groupId' => $groupId));
42
            $cache->set($group = $this->persistenceHandler->objectStateHandler()->loadGroup($groupId))->save();
43
        }
44
45
        return $group;
46
    }
47
48
    /**
49
     * {@inheritdoc}
@@ 161-171 (lines=11) @@
158
    /**
159
     * {@inheritdoc}
160
     */
161
    public function load($stateId)
162
    {
163
        $cache = $this->cache->getItem('objectstate', $stateId);
164
        $objectState = $cache->get();
165
        if ($cache->isMiss()) {
166
            $this->logger->logCall(__METHOD__, array('stateId' => $stateId));
167
            $cache->set($objectState = $this->persistenceHandler->objectStateHandler()->load($stateId))->save();
168
        }
169
170
        return $objectState;
171
    }
172
173
    /**
174
     * {@inheritdoc}

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

@@ 50-60 (lines=11) @@
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function load($id)
51
    {
52
        $cache = $this->cache->getItem('section', $id);
53
        $section = $cache->get();
54
        if ($cache->isMiss()) {
55
            $this->logger->logCall(__METHOD__, array('section' => $id));
56
            $cache->set($section = $this->persistenceHandler->sectionHandler()->load($id))->save();
57
        }
58
59
        return $section;
60
    }
61
62
    /**
63
     * {@inheritdoc}

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

@@ 236-248 (lines=13) @@
233
    /**
234
     * {@inheritdoc}
235
     */
236
    public function loadUrlAlias($id)
237
    {
238
        // Look for url alias cache
239
        $cache = $this->cache->getItem('urlAlias', $id);
240
        $urlAlias = $cache->get();
241
        if ($cache->isMiss()) {
242
            $this->logger->logCall(__METHOD__, array('alias' => $id));
243
            $urlAlias = $this->persistenceHandler->urlAliasHandler()->loadUrlAlias($id);
244
            $cache->set($urlAlias)->save();
245
        }
246
247
        return $urlAlias;
248
    }
249
250
    /**
251
     * {@inheritdoc}