Code Duplication    Length = 9-10 lines in 2 locations

src/Palladium/Service/Recovery.php 1 location

@@ 67-76 (lines=10) @@
64
        $identity = new Entity\PasswordIdentity;
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/SignUp.php 1 location

@@ 85-93 (lines=9) @@
82
        $identity = new \Entity\Authentication\PasswordIdentity;
83
        $this->retrieveIdenityByToken($identity, $token, \Entity\Authentication\Identity::ACTION_VERIFY);
84
85
        if ($identity->getId() === null) {
86
            $this->logger->warning('no identity with given verification token', [
87
                'input' => [
88
                    'token' => $token,
89
                ],
90
            ]);
91
92
            throw new TokenNotFound;
93
        }
94
95
        $identity->setStatus(\Entity\Authentication\Identity::STATUS_ACTIVE);
96
        $identity->clearToken();