mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-31 15:30:01 +02:00
refactor (#4244)
This commit is contained in:
parent
bb2f471a03
commit
6a24e53d6c
7 changed files with 69 additions and 66 deletions
|
@ -2,12 +2,12 @@
|
|||
|
||||
final class RssBridge
|
||||
{
|
||||
private static Container $container;
|
||||
private Container $container;
|
||||
|
||||
public function __construct(
|
||||
Container $container
|
||||
) {
|
||||
self::$container = $container;
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
public function main(Request $request): Response
|
||||
|
@ -20,7 +20,7 @@ final class RssBridge
|
|||
return new Response(render(__DIR__ . '/../templates/error.html.php', ['message' => 'Invalid action']), 400);
|
||||
}
|
||||
|
||||
$handler = self::$container[$actionName];
|
||||
$handler = $this->container[$actionName];
|
||||
|
||||
$middlewares = [
|
||||
new SecurityMiddleware(),
|
||||
|
@ -36,20 +36,4 @@ final class RssBridge
|
|||
}
|
||||
return $action($request);
|
||||
}
|
||||
|
||||
public static function getLogger(): Logger
|
||||
{
|
||||
// null logger is only for the tests not to fail
|
||||
return self::$container['logger'] ?? new NullLogger();
|
||||
}
|
||||
|
||||
public static function getCache(): CacheInterface
|
||||
{
|
||||
return self::$container['cache'];
|
||||
}
|
||||
|
||||
public static function getHttpClient(): HttpClient
|
||||
{
|
||||
return self::$container['http_client'];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue