| @@ 45-64 (lines=20) @@ | ||
| 42 | * |
|
| 43 | * @return Palladium\Entity\Identity |
|
| 44 | */ |
|
| 45 | public function findIdentityById($identityId) |
|
| 46 | { |
|
| 47 | $identity = new Entity\Identity; |
|
| 48 | $identity->setId($identityId); |
|
| 49 | ||
| 50 | $mapper = $this->mapperFactory->create(Mapper\Identity::class); |
|
| 51 | $mapper->fetch($identity); |
|
| 52 | ||
| 53 | if ($identity->getAccountId() === null) { |
|
| 54 | $this->logger->notice('identity not found', [ |
|
| 55 | 'input' => [ |
|
| 56 | 'id' => $identityId, |
|
| 57 | ], |
|
| 58 | ]); |
|
| 59 | ||
| 60 | throw new IdentityNotFound; |
|
| 61 | } |
|
| 62 | ||
| 63 | return $identity; |
|
| 64 | } |
|
| 65 | ||
| 66 | ||
| 67 | /** |
|
| @@ 76-95 (lines=20) @@ | ||
| 73 | * |
|
| 74 | * @return Palladium\Entity\EmailIdentity |
|
| 75 | */ |
|
| 76 | public function findEmailIdentityByEmailAddress(string $emailAddress) |
|
| 77 | { |
|
| 78 | $identity = new Entity\EmailIdentity; |
|
| 79 | $identity->setEmailAddress($emailAddress); |
|
| 80 | ||
| 81 | $mapper = $this->mapperFactory->create(Mapper\EmailIdentity::class); |
|
| 82 | $mapper->fetch($identity); |
|
| 83 | ||
| 84 | if ($identity->getId() === null) { |
|
| 85 | $this->logger->notice('identity not found', [ |
|
| 86 | 'input' => [ |
|
| 87 | 'email' => $emailAddress, |
|
| 88 | ], |
|
| 89 | ]); |
|
| 90 | ||
| 91 | throw new IdentityNotFound; |
|
| 92 | } |
|
| 93 | ||
| 94 | return $identity; |
|
| 95 | } |
|
| 96 | ||
| 97 | ||
| 98 | public function findOneTimeIdentityByNonce(string $nonce) |
|
| @@ 98-117 (lines=20) @@ | ||
| 95 | } |
|
| 96 | ||
| 97 | ||
| 98 | public function findOneTimeIdentityByNonce(string $nonce) |
|
| 99 | { |
|
| 100 | $identity = new Entity\OneTimeIdentity; |
|
| 101 | $identity->setNonce($nonce); |
|
| 102 | ||
| 103 | $mapper = $this->mapperFactory->create(Mapper\EmailIdentity::class); |
|
| 104 | $mapper->fetch($identity); |
|
| 105 | ||
| 106 | if ($identity->getId() === null) { |
|
| 107 | $this->logger->notice('identity not found', [ |
|
| 108 | 'input' => [ |
|
| 109 | 'nonce' => $nonce, |
|
| 110 | ], |
|
| 111 | ]); |
|
| 112 | ||
| 113 | throw new IdentityNotFound; |
|
| 114 | } |
|
| 115 | ||
| 116 | return $identity; |
|
| 117 | } |
|
| 118 | ||
| 119 | ||
| 120 | /** |
|