seria/src/SiteInfo.php

35 lines
925 B
PHP
Raw Normal View History

<?php
namespace Seria;
use Seria\Users\UserInfo;
// this should pull from some db config or something at some point
class SiteInfo {
public function getName(): string {
return SERIA_FLASHII . ' Tracker';
}
public function getHost(): string {
return (string)filter_input(INPUT_SERVER, 'HTTP_HOST');
}
public function getMainSiteName(): string {
return SERIA_FLASHIINET;
}
public function getProfileUrl(UserInfo|string $userInfo): string {
if($userInfo instanceof UserInfo)
$userInfo = $userInfo->getId();
return sprintf(SERIA_PROFILE_FORMAT, $userInfo);
}
public function getAvatarUrl(UserInfo|string $userInfo, int $res = 0): string {
if($userInfo instanceof UserInfo)
$userInfo = $userInfo->getId();
return sprintf($res < 1 ? SERIA_AVATAR_FORMAT : SERIA_AVATAR_FORMAT_RES, $userInfo, $res);
}
}