48 lines
1 KiB
PHP
48 lines
1 KiB
PHP
|
<?php
|
||
|
namespace EEPROM\Blacklist;
|
||
|
|
||
|
use Index\DateTime;
|
||
|
use Index\Data\IDbResult;
|
||
|
|
||
|
class BlacklistInfo {
|
||
|
private string $hash;
|
||
|
private string $reason;
|
||
|
private int $created;
|
||
|
|
||
|
public const REASONS = [
|
||
|
'copyright',
|
||
|
'rules',
|
||
|
'other',
|
||
|
];
|
||
|
|
||
|
public function __construct(IDbResult $result) {
|
||
|
$this->hash = $result->getString(0);
|
||
|
$this->reason = $result->getString(1);
|
||
|
$this->created = $result->getInteger(2);
|
||
|
}
|
||
|
|
||
|
public function getHash(): string {
|
||
|
return $this->hash;
|
||
|
}
|
||
|
|
||
|
public function getReason(): string {
|
||
|
return $this->reason;
|
||
|
}
|
||
|
|
||
|
public function isCopyrightTakedown(): bool {
|
||
|
return $this->reason === 'copyright';
|
||
|
}
|
||
|
|
||
|
public function isRulesViolation(): bool {
|
||
|
return $this->reason === 'rules';
|
||
|
}
|
||
|
|
||
|
public function getCreatedTime(): int {
|
||
|
return $this->created;
|
||
|
}
|
||
|
|
||
|
public function getCreatedAt(): DateTime {
|
||
|
return DateTime::fromUnixTimeSeconds($this->created);
|
||
|
}
|
||
|
}
|