Code Duplication    Length = 20-21 lines in 2 locations

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

@@ 81-101 (lines=21) @@
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function loadByEmail($email)
82
    {
83
        $cacheItem = $this->cache->getItem('ez-user-' . str_replace('@', 'ยง', $email) . '-by-email');
84
        if ($cacheItem->isHit()) {
85
            return $cacheItem->get();
86
        }
87
88
        $this->logger->logCall(__METHOD__, array('email' => $email));
89
        $users = $this->persistenceHandler->userHandler()->loadByEmail($email);
90
91
        $cacheItem->set($users);
92
        $cacheTags = [];
93
        foreach ($users as $user) {
94
            $cacheTags[] = 'content-' . $user->id;
95
            $cacheTags[] = 'user-' . $user->id;
96
        }
97
        $cacheItem->tag($cacheTags);
98
        $this->cache->save($cacheItem);
99
100
        return $users;
101
    }
102
103
    /**
104
     * {@inheritdoc}

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

@@ 99-118 (lines=20) @@
96
    /**
97
     * {@inheritdoc}
98
     */
99
    public function loadObjectStates($groupId)
100
    {
101
        $cacheItem = $this->cache->getItem('ez-state-list-' . $groupId . '-by-group');
102
        if ($cacheItem->isHit()) {
103
            return $cacheItem->get();
104
        }
105
106
        $this->logger->logCall(__METHOD__, array('groupId' => $groupId));
107
        $objectStates = $this->persistenceHandler->objectStateHandler()->loadObjectStates($groupId);
108
109
        $cacheItem->set($objectStates);
110
        $cacheTags = ['state-group-' . $groupId];
111
        foreach ($objectStates as $state) {
112
            $cacheTags[] = 'state-' . $state->id;
113
        }
114
        $cacheItem->tag($cacheTags);
115
        $this->cache->save($cacheItem);
116
117
        return $objectStates;
118
    }
119
120
    /**
121
     * {@inheritdoc}