145 lines
3.6 KiB
PHP
145 lines
3.6 KiB
PHP
|
<?php
|
||
|
namespace Makai;
|
||
|
|
||
|
use Index\AString;
|
||
|
use Index\WString;
|
||
|
use Index\DateTime;
|
||
|
|
||
|
class ProjectInfo {
|
||
|
private string $id;
|
||
|
private WString $name;
|
||
|
private AString $nameClean;
|
||
|
private ?WString $summary;
|
||
|
private ?WString $description;
|
||
|
private bool $featured;
|
||
|
private int $order;
|
||
|
private ?int $colour;
|
||
|
private string $type;
|
||
|
private ?AString $homepage;
|
||
|
private ?AString $source;
|
||
|
private ?AString $discussion;
|
||
|
private DateTime $createdAt;
|
||
|
private ?DateTime $archivedAt;
|
||
|
private ?DateTime $deletedAt;
|
||
|
|
||
|
public function __construct(
|
||
|
string $id, WString $name, AString $nameClean,
|
||
|
?WString $summary, ?WString $description,
|
||
|
bool $featured, int $order, ?int $colour, string $type,
|
||
|
?AString $homepage, ?AString $source, ?AString $discussion,
|
||
|
int $createdAt, ?int $archivedAt, ?int $deletedAt
|
||
|
) {
|
||
|
$this->id = $id;
|
||
|
$this->name = $name;
|
||
|
$this->nameClean = $nameClean;
|
||
|
$this->summary = $summary;
|
||
|
$this->description = $description;
|
||
|
$this->featured = $featured;
|
||
|
$this->order = $order;
|
||
|
$this->colour = $colour;
|
||
|
$this->type = $type;
|
||
|
$this->homepage = $homepage;
|
||
|
$this->source = $source;
|
||
|
$this->discussion = $discussion;
|
||
|
$this->createdAt = DateTime::fromUnixTimeSeconds($createdAt);
|
||
|
$this->archivedAt = $archivedAt === null ? null : DateTime::fromUnixTimeSeconds($archivedAt);
|
||
|
$this->deletedAt = $deletedAt === null ? null : DateTime::fromUnixTimeSeconds($deletedAt);
|
||
|
}
|
||
|
|
||
|
public function getId(): string {
|
||
|
return $this->id;
|
||
|
}
|
||
|
|
||
|
public function getName(): WString {
|
||
|
return $this->name;
|
||
|
}
|
||
|
|
||
|
public function getCleanName(): AString {
|
||
|
return $this->nameClean;
|
||
|
}
|
||
|
|
||
|
public function hasSummary(): bool {
|
||
|
return $this->summary !== null;
|
||
|
}
|
||
|
|
||
|
public function getSummary(): ?WString {
|
||
|
return $this->summary;
|
||
|
}
|
||
|
|
||
|
public function hasDescription(): bool {
|
||
|
return $this->description !== null;
|
||
|
}
|
||
|
|
||
|
public function getDescription(): ?WString {
|
||
|
return $this->description;
|
||
|
}
|
||
|
|
||
|
public function isFeatured(): bool {
|
||
|
return $this->featured;
|
||
|
}
|
||
|
|
||
|
public function getOrder(): int {
|
||
|
return $this->order;
|
||
|
}
|
||
|
|
||
|
public function hasColour(): bool {
|
||
|
return $this->colour !== null;
|
||
|
}
|
||
|
|
||
|
public function getColour(): ?int {
|
||
|
return $this->colour;
|
||
|
}
|
||
|
|
||
|
public function getProjectType(): string {
|
||
|
return $this->type;
|
||
|
}
|
||
|
|
||
|
public function isTool(): bool {
|
||
|
return $this->getProjectType() === 'Tool';
|
||
|
}
|
||
|
|
||
|
public function hasHomePageUrl(): bool {
|
||
|
return $this->homepage !== null;
|
||
|
}
|
||
|
|
||
|
public function getHomePageUrl(): ?AString {
|
||
|
return $this->homepage;
|
||
|
}
|
||
|
|
||
|
public function hasSourceUrl(): bool {
|
||
|
return $this->source !== null;
|
||
|
}
|
||
|
|
||
|
public function getSourceUrl(): ?AString {
|
||
|
return $this->source;
|
||
|
}
|
||
|
|
||
|
public function hasDiscussionUrl(): bool {
|
||
|
return $this->discussion !== null;
|
||
|
}
|
||
|
|
||
|
public function getDiscussionUrl(): ?AString {
|
||
|
return $this->discussion;
|
||
|
}
|
||
|
|
||
|
public function getCreatedAt(): DateTime {
|
||
|
return $this->createdAt;
|
||
|
}
|
||
|
|
||
|
public function getArchivedAt(): ?DateTime {
|
||
|
return $this->archivedAt;
|
||
|
}
|
||
|
|
||
|
public function isArchived(): bool {
|
||
|
return $this->archivedAt !== null;
|
||
|
}
|
||
|
|
||
|
public function getDeletedAt(): ?DateTime {
|
||
|
return $this->deletedAt;
|
||
|
}
|
||
|
|
||
|
public function isDeleted(): bool {
|
||
|
return $this->deletedAt !== null;
|
||
|
}
|
||
|
}
|