flash.moe/src/LanguageInfo.php

39 lines
883 B
PHP
Raw Normal View History

2022-02-05 03:35:42 +00:00
<?php
namespace Makai;
2023-10-12 18:45:11 +00:00
use Index\Colour\Colour;
use Index\Colour\ColourRGB;
2023-10-12 19:03:00 +00:00
use Index\Data\IDbResult;
2022-02-05 03:35:42 +00:00
class LanguageInfo {
2022-02-06 01:36:05 +00:00
private string $id;
2023-10-12 18:52:24 +00:00
private string $name;
2022-02-05 03:35:42 +00:00
private ?int $colour;
2023-10-12 19:03:00 +00:00
public function __construct(IDbResult $result) {
$this->id = $result->getString(0);
$this->name = $result->getString(1);
$this->colour = $result->isNull(2) ? null : $result->getInteger(2);
2022-02-05 03:35:42 +00:00
}
2022-02-06 01:36:05 +00:00
public function getId(): string {
2022-02-05 03:35:42 +00:00
return $this->id;
}
2023-10-12 18:52:24 +00:00
public function getName(): string {
2022-02-05 03:35:42 +00:00
return $this->name;
}
public function hasColour(): bool {
return $this->colour !== null;
}
2023-10-12 18:45:11 +00:00
public function getColour(): Colour {
return $this->colour === null ? Colour::none() : ColourRGB::fromRawRGB($this->colour);
}
public function getColourRaw(): ?int {
2022-02-05 03:35:42 +00:00
return $this->colour;
}
}