1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-06 08:37:30 +02:00

refactor: extract CurlHttpClient (#3532)

* refactor: extract CurlHttpClient

* refactor

* interface
This commit is contained in:
Dag
2023-07-16 22:07:34 +02:00
committed by GitHub
parent 7b46b97abd
commit a59793e8d6
4 changed files with 145 additions and 138 deletions

View File

@@ -2,6 +2,7 @@
final class RssBridge
{
private static HttpClient $httpClient;
private static CacheInterface $cache;
public function main(array $argv = [])
@@ -71,9 +72,10 @@ final class RssBridge
// Consider: ini_set('error_reporting', E_ALL & ~E_DEPRECATED);
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
// Create cache
$cacheFactory = new CacheFactory();
self::setCache($cacheFactory->create());
self::$httpClient = new CurlHttpClient();
self::$cache = $cacheFactory->create();
if (Configuration::getConfig('authentication', 'enable')) {
$authenticationMiddleware = new AuthenticationMiddleware();
@@ -105,13 +107,13 @@ final class RssBridge
}
}
public static function getHttpClient(): HttpClient
{
return self::$httpClient;
}
public static function getCache(): CacheInterface
{
return self::$cache;
}
public static function setCache(CacheInterface $cache): void
{
self::$cache = $cache;
}
}