- added ADMIN index file
- cleanup config - added Asset Controller
This commit is contained in:
parent
7ba4e3e0a6
commit
fe7bacd2f6
14 changed files with 300 additions and 33 deletions
|
|
@ -14,6 +14,8 @@ class Config
|
|||
private array $renderer = [];
|
||||
private bool $maintenance = false;
|
||||
private bool $devMode = false;
|
||||
private bool $isAdmin = false;
|
||||
private string $baseUrl = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
|
|
@ -38,29 +40,17 @@ class Config
|
|||
|
||||
public function setAPIAuth(array $array): void
|
||||
{
|
||||
if ($this->isWriteable) {
|
||||
$this->api = $array;
|
||||
} else {
|
||||
trigger_error('try to write closed config!');
|
||||
}
|
||||
$this->set('api', $array);
|
||||
}
|
||||
|
||||
public function setRender(array $array): void
|
||||
{
|
||||
if ($this->isWriteable) {
|
||||
$this->renderer = $array;
|
||||
} else {
|
||||
trigger_error('try to write closed config!');
|
||||
}
|
||||
$this->set('renderer', $array);
|
||||
}
|
||||
|
||||
public function setMaintainMode(bool $mode): void
|
||||
{
|
||||
if ($this->isWriteable) {
|
||||
$this->maintenance = $mode;
|
||||
} else {
|
||||
trigger_error('try to write closed config!');
|
||||
}
|
||||
$this->set('maintenance', $mode);
|
||||
}
|
||||
|
||||
public function getVersion(): float
|
||||
|
|
@ -70,12 +60,7 @@ class Config
|
|||
|
||||
public function setVersion(float $param): void
|
||||
{
|
||||
if ($this->isWriteable) {
|
||||
$this->version = $param;
|
||||
} else {
|
||||
trigger_error('try to write closed config!');
|
||||
}
|
||||
|
||||
$this->set('version', $param);
|
||||
}
|
||||
|
||||
public function getApi(): array
|
||||
|
|
@ -90,11 +75,7 @@ class Config
|
|||
|
||||
public function setMail(array $array): void
|
||||
{
|
||||
if ($this->isWriteable) {
|
||||
$this->mail = $array;
|
||||
} else {
|
||||
trigger_error('try to write closed config!');
|
||||
}
|
||||
$this->set('mail', $array);
|
||||
}
|
||||
|
||||
public function getRenderer(): array
|
||||
|
|
@ -114,11 +95,35 @@ class Config
|
|||
|
||||
public function setDevMode(bool $mode): void
|
||||
{
|
||||
if ($this->isWriteable) {
|
||||
$this->devMode = $mode;
|
||||
} else {
|
||||
trigger_error('try to write closed config!');
|
||||
}
|
||||
$this->set('devMode', $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isAdmin(): bool
|
||||
{
|
||||
return $this->isAdmin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $isAdmin
|
||||
*/
|
||||
public function setIsAdmin(bool $isAdmin): void
|
||||
{
|
||||
$this->set('isAdmin', $isAdmin);
|
||||
}
|
||||
|
||||
public function setBaseUrl(string $url) {
|
||||
$this->set('baseUrl', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isClosed(): bool
|
||||
{
|
||||
return !$this->isWriteable;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -128,4 +133,17 @@ class Config
|
|||
{
|
||||
$this->isWriteable = false;
|
||||
}
|
||||
|
||||
public function set(string $variable, $value) {
|
||||
if (!$this->isWriteable) {
|
||||
trigger_error('try to write closed config!');
|
||||
return;
|
||||
}
|
||||
$this->$variable = $value;
|
||||
}
|
||||
|
||||
public function getBaseUrl()
|
||||
{
|
||||
return $this->baseUrl;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue