flash.moe/src/Projects/LanguageInfo.php
2023-10-12 22:09:04 +00:00

38 lines
892 B
PHP

<?php
namespace Makai\Projects;
use Index\Colour\Colour;
use Index\Colour\ColourRGB;
use Index\Data\IDbResult;
class LanguageInfo {
private string $id;
private string $name;
private ?int $colour;
public function __construct(IDbResult $result) {
$this->id = $result->getString(0);
$this->name = $result->getString(1);
$this->colour = $result->isNull(2) ? null : $result->getInteger(2);
}
public function getId(): string {
return $this->id;
}
public function getName(): string {
return $this->name;
}
public function hasColour(): bool {
return $this->colour !== null;
}
public function getColour(): Colour {
return $this->colour === null ? Colour::none() : ColourRGB::fromRawRGB($this->colour);
}
public function getColourRaw(): ?int {
return $this->colour;
}
}