1
0
Fork 0

Remove DependencyFactory

- Include all necessary classes in `dependencies.config.php`
- Add DI-reference to BaseObject (acts as a global registry)
- Refactor all static "init()" methods to use the global registry

- Refactor Logging for Worker-Logger a little bit
This commit is contained in:
Philipp Holzer 2019-07-21 20:24:16 +02:00
commit 6c2cf494b5
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
21 changed files with 188 additions and 280 deletions

View file

@ -197,32 +197,6 @@ class App
return $this->mode;
}
/**
* Returns the router of the Application
*
* @return App\Router
*/
public function getRouter()
{
return $this->router;
}
/**
* @return Database
*/
public function getDatabase()
{
return $this->database;
}
/**
* @return L10n
*/
public function getL10n()
{
return $this->l10n;
}
/**
* Register a stylesheet file path to be included in the <head> tag of every page.
* Inclusion is done in App->initHead().
@ -270,14 +244,11 @@ class App
* @param LoggerInterface $logger The current app logger
* @param Profiler $profiler The profiler of this application
* @param L10n $l10n The translator instance
* @param bool $isBackend Whether it is used for backend or frontend (Default true=backend)
*
* @throws Exception if the Basepath is not usable
*/
public function __construct(Database $database, Configuration $config, App\Mode $mode, App\Router $router, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, $isBackend = true)
public function __construct(Database $database, Configuration $config, App\Mode $mode, App\Router $router, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n)
{
BaseObject::setApp($this);
$this->database = $database;
$this->config = $config;
$this->mode = $mode;
@ -354,7 +325,7 @@ class App
$this->module = 'home';
}
$this->isBackend = $isBackend || $this->checkBackend($this->module);
$this->isBackend = $this->isBackend || $this->checkBackend($this->module);
// Detect mobile devices
$mobile_detect = new MobileDetect();
@ -375,6 +346,8 @@ class App
*/
public function reload()
{
$this->isBackend = basename($_SERVER['PHP_SELF'], '.php') !== 'index';
$this->getMode()->determine($this->getBasePath());
if ($this->getMode()->has(App\Mode::DBAVAILABLE)) {