hanyuu/src/Users/Db/DbUserEMailInfo.php

49 lines
1.3 KiB
PHP

<?php
namespace Hanyuu\Users\Db;
use Index\DateTime;
use Index\Data\IDbResult;
use Hanyuu\Users\IUserEMailInfo;
class DbUserEMailInfo implements IUserEMailInfo {
private string $userId;
private string $address;
private DateTime $created;
private bool $isVerified;
private DateTime $verified;
private bool $isRecovery;
public function __construct(IDbResult $result) {
$this->userId = $result->getString(0);
$this->address = $result->getString(1);
$this->created = DateTime::fromUnixTimeSeconds($result->getInteger(2));
$this->isVerified = !$result->isNull(3);
$this->verified = DateTime::fromUnixTimeSeconds($result->isNull(3) ? 0 : $result->getInteger(3));
$this->isRecovery = $result->getInteger(4) !== 0;
}
public function getUserId(): string {
return $this->userId;
}
public function getAddress(): string {
return $this->address;
}
public function getCreatedTime(): DateTime {
return $this->created;
}
public function isVerified(): bool {
return $this->isVerified;
}
public function getVerifiedTime(): DateTime {
return $this->verified;
}
public function isRecovery(): bool {
return $this->isRecovery;
}
}