Code Duplication    Length = 14-15 lines in 2 locations

src/Palladium/Service/Identification.php 2 locations

@@ 37-50 (lines=14) @@
34
35
    public function loginWithPassword(Entity\EmailIdentity $identity, $password)
36
    {
37
        if ($identity->matchKey($password) === false) {
38
            $this->logger->warning('wrong password', [
39
                'input' => [
40
                    'identifier' => $identity->getIdentifier(),
41
                    'key' => md5($password),
42
                ],
43
                'account' => [
44
                    'user' => $identity->getUserId(),
45
                    'identity' => $identity->getId(),
46
                ],
47
            ]);
48
49
            throw new PasswordNotMatch;
50
        }
51
52
        $this->registerUsageOfIdentity($identity);
53
        $cookie = $this->createCookieIdentity($identity);
@@ 220-234 (lines=15) @@
217
    {
218
        $mapper = $this->mapperFactory->create(Mapper\EmailIdentity::class);
219
220
        if ($identity->matchKey($oldKey) === false) {
221
            $this->logger->warning('wrong password', [
222
                'input' => [
223
                    'user' => $identity->getUserId(),
224
                    'old-key' => md5($oldKey),
225
                    'new-key' => md5($newKey),
226
                ],
227
                'account' => [
228
                    'user' => $identity->getUserId(),
229
                    'identity' => $identity->getId(),
230
                ],
231
            ]);
232
233
            throw new PasswordNotMatch;
234
        }
235
236
        $identity->setPassword($newKey);
237
        $mapper->store($identity);