Removed Application class! (finally)
This commit is contained in:
parent
1f22a1e4b9
commit
45b75f79cd
2 changed files with 0 additions and 60 deletions
|
@ -63,8 +63,6 @@ require_once 'src/Users/validation.php';
|
||||||
config_load(MSZ_ROOT . '/config/config.ini');
|
config_load(MSZ_ROOT . '/config/config.ini');
|
||||||
mail_prepare(config_get_default([], 'Mail'));
|
mail_prepare(config_get_default([], 'Mail'));
|
||||||
|
|
||||||
$app = new Application;
|
|
||||||
|
|
||||||
if (!empty($errorReporter)) {
|
if (!empty($errorReporter)) {
|
||||||
$errorReporter->setReportInfo(
|
$errorReporter->setReportInfo(
|
||||||
config_get('Exceptions', 'report_url'),
|
config_get('Exceptions', 'report_url'),
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<?php
|
|
||||||
namespace Misuzu;
|
|
||||||
|
|
||||||
use UnexpectedValueException;
|
|
||||||
use GeoIp2\Database\Reader as GeoIP;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the set up procedures.
|
|
||||||
* @package Misuzu
|
|
||||||
*/
|
|
||||||
final class Application
|
|
||||||
{
|
|
||||||
private static $instance = null;
|
|
||||||
|
|
||||||
private $geoipInstance = null;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
if (!empty(self::$instance)) {
|
|
||||||
throw new UnexpectedValueException('An Application has already been set up.');
|
|
||||||
}
|
|
||||||
|
|
||||||
self::$instance = $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function startGeoIP(): void
|
|
||||||
{
|
|
||||||
if (!empty($this->geoipInstance)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->geoipInstance = new GeoIP(config_get_default('', 'GeoIP', 'database_path'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getGeoIP(): GeoIP
|
|
||||||
{
|
|
||||||
if (empty($this->geoipInstance)) {
|
|
||||||
$this->startGeoIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->geoipInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function geoip(): GeoIP
|
|
||||||
{
|
|
||||||
return self::getInstance()->getGeoIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
// used in some of the user functions still, fix that
|
|
||||||
public static function getInstance(): Application
|
|
||||||
{
|
|
||||||
if (empty(self::$instance)) {
|
|
||||||
throw new UnexpectedValueException('No instances.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::$instance;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue