51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
namespace Misuzu\News;
|
|
|
|
use Index\DateTime;
|
|
use Index\Data\IDbResult;
|
|
|
|
class NewsCategoryInfo {
|
|
private string $id;
|
|
private string $name;
|
|
private string $description;
|
|
private bool $hidden;
|
|
private int $created;
|
|
private int $posts;
|
|
|
|
public function __construct(IDbResult $result) {
|
|
$this->id = (string)$result->getInteger(0);
|
|
$this->name = $result->getString(1);
|
|
$this->description = $result->getString(2);
|
|
$this->hidden = $result->getInteger(3) !== 0;
|
|
$this->created = $result->getInteger(4);
|
|
$this->posts = $result->getInteger(5);
|
|
}
|
|
|
|
public function getId(): string {
|
|
return $this->id;
|
|
}
|
|
|
|
public function getName(): string {
|
|
return $this->name;
|
|
}
|
|
|
|
public function getDescription(): string {
|
|
return $this->description;
|
|
}
|
|
|
|
public function isHidden(): bool {
|
|
return $this->hidden;
|
|
}
|
|
|
|
public function getCreatedTime(): int {
|
|
return $this->created;
|
|
}
|
|
|
|
public function getCreatedAt(): DateTime {
|
|
return DateTime::fromUnixTimeSeconds($this->created);
|
|
}
|
|
|
|
public function getPostsCount(): int {
|
|
return $this->posts;
|
|
}
|
|
}
|