mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-31 07:09:34 +02:00
refactor (#3668)
This commit is contained in:
parent
cf7e3eea56
commit
e6aef73a02
15 changed files with 134 additions and 384 deletions
|
@ -15,6 +15,9 @@ final class RssBridge
|
|||
}
|
||||
Configuration::loadConfiguration($customConfig, getenv());
|
||||
|
||||
// Consider: ini_set('error_reporting', E_ALL & ~E_DEPRECATED);
|
||||
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
|
||||
|
||||
set_exception_handler(function (\Throwable $e) {
|
||||
Logger::error('Uncaught Exception', ['e' => $e]);
|
||||
http_response_code(500);
|
||||
|
@ -57,9 +60,6 @@ final class RssBridge
|
|||
}
|
||||
});
|
||||
|
||||
// Consider: ini_set('error_reporting', E_ALL & ~E_DEPRECATED);
|
||||
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
|
||||
|
||||
self::$httpClient = new CurlHttpClient();
|
||||
|
||||
$cacheFactory = new CacheFactory();
|
||||
|
@ -68,11 +68,6 @@ final class RssBridge
|
|||
} else {
|
||||
self::$cache = $cacheFactory->create();
|
||||
}
|
||||
|
||||
if (Configuration::getConfig('authentication', 'enable')) {
|
||||
$authenticationMiddleware = new AuthenticationMiddleware();
|
||||
$authenticationMiddleware();
|
||||
}
|
||||
}
|
||||
|
||||
public function main(array $argv = []): void
|
||||
|
@ -81,6 +76,10 @@ final class RssBridge
|
|||
parse_str(implode('&', array_slice($argv, 1)), $cliArgs);
|
||||
$request = $cliArgs;
|
||||
} else {
|
||||
if (Configuration::getConfig('authentication', 'enable')) {
|
||||
$authenticationMiddleware = new AuthenticationMiddleware();
|
||||
$authenticationMiddleware();
|
||||
}
|
||||
$request = array_merge($_GET, $_POST);
|
||||
}
|
||||
|
||||
|
@ -124,10 +123,4 @@ final class RssBridge
|
|||
{
|
||||
return self::$cache ?? new NullCache();
|
||||
}
|
||||
|
||||
public function clearCache()
|
||||
{
|
||||
$cache = self::getCache();
|
||||
$cache->clear();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue