Code Duplication    Length = 14-15 lines in 2 locations

src/Palladium/Service/Identification.php 2 locations

@@ 44-57 (lines=14) @@
41
42
    public function loginWithPassword(Entity\EmailIdentity $identity, $password)
43
    {
44
        if ($identity->matchKey($password) === false) {
45
            $this->logger->warning('wrong password', [
46
                'input' => [
47
                    'identifier' => $identity->getIdentifier(),
48
                    'key' => md5($password),
49
                ],
50
                'account' => [
51
                    'user' => $identity->getUserId(),
52
                    'identity' => $identity->getId(),
53
                ],
54
            ]);
55
56
            throw new PasswordNotMatch;
57
        }
58
59
        $this->registerUsageOfIdentity($identity);
60
        $cookie = $this->createCookieIdentity($identity);
@@ 275-289 (lines=15) @@
272
273
        $mapper = $this->mapperFactory->create(Mapper\EmailIdentity::class);
274
275
        if ($identity->matchKey($oldKey) === false) {
276
            $this->logger->warning('wrong password', [
277
                'input' => [
278
                    'user' => $userId,
279
                    'old-key' => md5($oldKey),
280
                    'new-key' => md5($newKey),
281
                ],
282
                'account' => [
283
                    'user' => $identity->getUserId(),
284
                    'identity' => $identity->getId(),
285
                ],
286
            ]);
287
288
            throw new PasswordNotMatch;
289
        }
290
291
        $identity->setKey($newKey);
292
        $mapper->store($identity);