mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-03 16:19:45 +00:00
yuop (#4193)
This commit is contained in:
parent
401cc187b7
commit
6ec9193546
@ -19,7 +19,7 @@ class ConnectivityAction implements ActionInterface
|
||||
$this->bridgeFactory = new BridgeFactory();
|
||||
}
|
||||
|
||||
public function execute(Request $request)
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
if (!Debug::isEnabled()) {
|
||||
return new Response('This action is only available in debug mode!', 403);
|
||||
@ -27,7 +27,7 @@ class ConnectivityAction implements ActionInterface
|
||||
|
||||
$bridgeName = $request->get('bridge');
|
||||
if (!$bridgeName) {
|
||||
return render_template('connectivity.html.php');
|
||||
return new Response(render_template('connectivity.html.php'));
|
||||
}
|
||||
$bridgeClassName = $this->bridgeFactory->createBridgeClassName($bridgeName);
|
||||
if (!$bridgeClassName) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
class DetectAction implements ActionInterface
|
||||
{
|
||||
public function execute(Request $request)
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
$url = $request->get('url');
|
||||
$format = $request->get('format');
|
||||
|
@ -11,7 +11,7 @@ class DisplayAction implements ActionInterface
|
||||
$this->logger = RssBridge::getLogger();
|
||||
}
|
||||
|
||||
public function execute(Request $request)
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
$bridgeName = $request->get('bridge');
|
||||
$format = $request->get('format');
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
class FindfeedAction implements ActionInterface
|
||||
{
|
||||
public function execute(Request $request)
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
$url = $request->get('url');
|
||||
$format = $request->get('format');
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
final class FrontpageAction implements ActionInterface
|
||||
{
|
||||
public function execute(Request $request)
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
$messages = [];
|
||||
$activeBridges = 0;
|
||||
@ -26,13 +26,13 @@ final class FrontpageAction implements ActionInterface
|
||||
}
|
||||
|
||||
// todo: cache this renderered template?
|
||||
return render(__DIR__ . '/../templates/frontpage.html.php', [
|
||||
return new Response(render(__DIR__ . '/../templates/frontpage.html.php', [
|
||||
'messages' => $messages,
|
||||
'admin_email' => Configuration::getConfig('admin', 'email'),
|
||||
'admin_telegram' => Configuration::getConfig('admin', 'telegram'),
|
||||
'bridges' => $body,
|
||||
'active_bridges' => $activeBridges,
|
||||
'total_bridges' => count($bridgeClassNames),
|
||||
]);
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
class HealthAction implements ActionInterface
|
||||
{
|
||||
public function execute(Request $request)
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
$response = [
|
||||
'code' => 200,
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
class ListAction implements ActionInterface
|
||||
{
|
||||
public function execute(Request $request)
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
$list = new \stdClass();
|
||||
$list->bridges = [];
|
||||
|
@ -2,8 +2,5 @@
|
||||
|
||||
interface ActionInterface
|
||||
{
|
||||
/**
|
||||
* @return string|Response
|
||||
*/
|
||||
public function execute(Request $request);
|
||||
public function __invoke(Request $request): Response;
|
||||
}
|
||||
|
@ -100,11 +100,8 @@ final class RssBridge
|
||||
$className = '\\' . $actionName;
|
||||
$actionObject = new $className();
|
||||
|
||||
$response = $actionObject->execute($request);
|
||||
$response = $actionObject($request);
|
||||
|
||||
if (is_string($response)) {
|
||||
$response = new Response($response);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user