/** * 주어진 entity 정보를 저장소에 추가한다. * * @param PendingMailEntityInterface $entity 삽입할 정보 * * @return PendingMailEntityInterface */ public function insert($entity) { $now = $this->getCurrentTime(); $entity->createdAt = $entity->updatedAt = $now; $entity->confirmationCode = str_random(); $id = $this->table()->insertGetId($entity->getAttributes()); $entity->id = $id; return $entity; }
/** * 주어진 이메일의 인증코드를 검사한다. * * @param PendingMailEntityInterface $mail 인증할 이메일 정보 * @param string $code 인증코드 * * @return bool 주어진 이메일에 등록된 인증코드가 일치할 경우 true, 일치하지 않으면 false를 반환한다. */ protected function validateConfirmCode(PendingMailEntityInterface $mail, $code) { return $mail->getConfirmationCode() === $code; }