Code Duplication    Length = 9-10 lines in 2 locations

src/Palladium/Service/Recovery.php 1 location

@@ 67-76 (lines=10) @@
64
        $identity = new Entity\EmailIdentity;
65
        $this->retrieveIdenityByToken($identity, $token, Entity\Identity::ACTION_RESET);
66
67
        if ($identity->getId() === null) {
68
            $this->logger->warning('no account with given reset token', [
69
                'input' => [
70
                    'token' => $token,
71
                    'key' => md5($key),
72
                ],
73
            ]);
74
75
            throw new IdentityNotFound;
76
        }
77
78
        $identity->setKey($key);
79
        $identity->clearToken();

src/Palladium/Service/Registration.php 1 location

@@ 106-114 (lines=9) @@
103
        $identity = new Entity\EmailIdentity;
104
        $this->retrieveIdenityByToken($identity, $token, Identity::ACTION_VERIFY);
105
106
        if ($identity->getId() === null) {
107
            $this->logger->warning('no identity with given verification token', [
108
                'input' => [
109
                    'token' => $token,
110
                ],
111
            ]);
112
113
            throw new TokenNotFound;
114
        }
115
116
        $identity->setStatus(Identity::STATUS_ACTIVE);
117
        $identity->clearToken();