rework structure
added Router added .htaccess removed API-Module => is not used renamed batch to CRON
This commit is contained in:
parent
ccf2f506f0
commit
c33bb4cb3a
47 changed files with 1160 additions and 670 deletions
|
|
@ -1,158 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Venom;
|
||||
|
||||
use Venom\Database\DatabaseHandler;
|
||||
|
||||
class Config
|
||||
{
|
||||
private static ?Config $instance = null;
|
||||
private bool $isWriteable = true;
|
||||
private float $version = 1.0;
|
||||
private array $api = [];
|
||||
private array $mail = [];
|
||||
private array $renderer = [];
|
||||
private bool $maintenance = false;
|
||||
private bool $devMode = false;
|
||||
private bool $isAdmin = false;
|
||||
private string $baseUrl = '';
|
||||
private bool $seoMode = false;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function getInstance(): Config
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new Config();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public function setDatabase(array $array): void
|
||||
{
|
||||
if ($this->isWriteable) {
|
||||
DatabaseHandler::get()->init($array);
|
||||
} else {
|
||||
trigger_error('try to write closed config!');
|
||||
}
|
||||
}
|
||||
|
||||
public function setAPIAuth(array $array): void
|
||||
{
|
||||
$this->set('api', $array);
|
||||
}
|
||||
|
||||
public function setRender(array $array): void
|
||||
{
|
||||
$this->set('renderer', $array);
|
||||
}
|
||||
|
||||
public function setMaintainMode(bool $mode): void
|
||||
{
|
||||
$this->set('maintenance', $mode);
|
||||
}
|
||||
|
||||
public function getVersion(): float
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
public function setVersion(float $param): void
|
||||
{
|
||||
$this->set('version', $param);
|
||||
}
|
||||
|
||||
public function getApi(): array
|
||||
{
|
||||
return $this->api;
|
||||
}
|
||||
|
||||
public function getMail(): array
|
||||
{
|
||||
return $this->mail;
|
||||
}
|
||||
|
||||
public function setMail(array $array): void
|
||||
{
|
||||
$this->set('mail', $array);
|
||||
}
|
||||
|
||||
public function getRenderer(): array
|
||||
{
|
||||
return $this->renderer;
|
||||
}
|
||||
|
||||
public function isMaintenance(): bool
|
||||
{
|
||||
return $this->maintenance;
|
||||
}
|
||||
|
||||
public function isDevMode(): bool
|
||||
{
|
||||
return $this->devMode;
|
||||
}
|
||||
|
||||
public function setDevMode(bool $mode): void
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
public function setSeoMode(bool $mode) {
|
||||
$this->set('seoMode', $mode);
|
||||
}
|
||||
|
||||
public function getSeoEnabled() {
|
||||
return $this->seoMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isClosed(): bool
|
||||
{
|
||||
return !$this->isWriteable;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to close the write mode... this make sure after the config is init no other tool can write to it!
|
||||
*/
|
||||
public function close(): void
|
||||
{
|
||||
$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