misuzu/src/News/NewsCategoryInfo.php

52 lines
1.2 KiB
PHP
Raw Normal View History

2023-07-15 17:02:46 +00:00
<?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;
}
}