1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-20 07:11:43 +02:00

refactor: less reliance on super globals (#4228)

This commit is contained in:
Dag
2024-08-22 00:33:35 +02:00
committed by GitHub
parent 4a3919c1a3
commit 05e2c350b7
6 changed files with 23 additions and 16 deletions

View File

@@ -76,9 +76,17 @@ $httpClient = new CurlHttpClient();
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
$argv = $argv ?? null;
if ($argv) {
parse_str(implode('&', array_slice($argv, 1)), $cliArgs);
$request = Request::fromCli($cliArgs);
} else {
$request = Request::fromGlobals();
}
try {
$rssBridge = new RssBridge($logger, $cache, $httpClient);
$response = $rssBridge->main($argv ?? []);
$response = $rssBridge->main($request);
$response->send();
} catch (\Throwable $e) {
// Probably an exception inside an action