2023-09-08 20:40:48 +00:00
|
|
|
<?php
|
|
|
|
namespace Misuzu;
|
|
|
|
|
2023-10-20 22:29:28 +00:00
|
|
|
use Syokuhou\IConfig;
|
2023-09-08 20:40:48 +00:00
|
|
|
|
|
|
|
class SiteInfo {
|
|
|
|
private bool $loaded = false;
|
|
|
|
private array $props;
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
private IConfig $config
|
|
|
|
) {}
|
|
|
|
|
|
|
|
public function load(): void {
|
|
|
|
if($this->loaded)
|
|
|
|
return;
|
|
|
|
$this->loaded = true;
|
|
|
|
$this->props = $this->config->getValues([
|
|
|
|
['name:s', 'Misuzu'],
|
|
|
|
'desc:s',
|
|
|
|
'url:s',
|
|
|
|
'ext_logo:s',
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(): string {
|
|
|
|
$this->load();
|
|
|
|
return $this->props['name'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription(): string {
|
|
|
|
$this->load();
|
|
|
|
return $this->props['desc'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasURL(): bool {
|
|
|
|
return $this->getURL() !== '';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getURL(): string {
|
|
|
|
$this->load();
|
|
|
|
return rtrim($this->props['url'], '/');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasExternalLogo(): bool {
|
|
|
|
return $this->getExternalLogo() !== '';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getExternalLogo(): string {
|
|
|
|
$this->load();
|
|
|
|
return $this->props['ext_logo'];
|
|
|
|
}
|
|
|
|
}
|