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

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