98 lines
2.6 KiB
PHP
98 lines
2.6 KiB
PHP
<?php
|
|
namespace Mince;
|
|
|
|
use Index\DateTime;
|
|
use Index\Data\IDbResult;
|
|
|
|
class ServerInfo {
|
|
private string $id;
|
|
private string $name;
|
|
private string $details;
|
|
private ?string $javaAddress;
|
|
private ?string $javaVersion;
|
|
private ?string $bedrockAddress;
|
|
private ?string $bedrockVersion;
|
|
private int $created;
|
|
private ?int $deleted;
|
|
|
|
public function __construct(IDbResult $result) {
|
|
$this->id = $result->getString(0);
|
|
$this->name = $result->getString(1);
|
|
$this->details = $result->getString(2);
|
|
$this->javaAddress = $result->isNull(3) ? null : $result->getString(3);
|
|
$this->javaVersion = $result->isNull(4) ? null : $result->getString(4);
|
|
$this->bedrockAddress = $result->isNull(5) ? null : $result->getString(5);
|
|
$this->bedrockVersion = $result->isNull(6) ? null : $result->getString(6);
|
|
$this->created = $result->getInteger(7);
|
|
$this->deleted = $result->isNull(8) ? null : $result->getInteger(8);
|
|
}
|
|
|
|
public function getId(): string {
|
|
return $this->id;
|
|
}
|
|
|
|
public function getName(): string {
|
|
return $this->name;
|
|
}
|
|
|
|
public function hasDetails(): bool {
|
|
return $this->details !== '';
|
|
}
|
|
|
|
public function getDetails(): string {
|
|
return $this->details;
|
|
}
|
|
|
|
public function hasJavaAddress(): bool {
|
|
return $this->javaAddress !== null;
|
|
}
|
|
|
|
public function getJavaAddress(): ?string {
|
|
return $this->javaAddress;
|
|
}
|
|
|
|
public function hasJavaVersion(): bool {
|
|
return $this->javaVersion !== null;
|
|
}
|
|
|
|
public function getJavaVersion(): ?string {
|
|
return $this->javaVersion;
|
|
}
|
|
|
|
public function hasBedrockAddress(): bool {
|
|
return $this->bedrockAddress !== null;
|
|
}
|
|
|
|
public function getBedrockAddress(): ?string {
|
|
return $this->bedrockAddress;
|
|
}
|
|
|
|
public function hasBedrockVersion(): bool {
|
|
return $this->bedrockVersion !== null;
|
|
}
|
|
|
|
public function getBedrockVersion(): ?string {
|
|
return $this->bedrockVersion;
|
|
}
|
|
|
|
public function getCreatedTime(): int {
|
|
return $this->created;
|
|
}
|
|
|
|
public function getCreatedAt(): DateTime {
|
|
return DateTime::fromUnixTimeSeconds($this->created);
|
|
}
|
|
|
|
public function isDeleted(): bool {
|
|
return $this->deleted !== null;
|
|
}
|
|
|
|
public function getDeletedTime(): ?int {
|
|
return $this->deleted;
|
|
}
|
|
|
|
public function getDeletedAt(): ?DateTime {
|
|
return $this->deleted === null ? null : DateTime::fromUnixTimeSeconds($this->deleted);
|
|
}
|
|
}
|