rss-bridge/actions/ListAction.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
1.1 KiB
PHP
Raw Normal View History

2019-02-06 20:34:51 +03:00
<?php
2022-06-22 19:30:37 +03:00
class ListAction implements ActionInterface
{
2024-08-07 01:21:06 +03:00
public function __invoke(Request $request): Response
2019-02-06 20:34:51 +03:00
{
$list = new \stdClass();
2019-02-06 20:34:51 +03:00
$list->bridges = [];
$list->total = 0;
$bridgeFactory = new BridgeFactory();
foreach ($bridgeFactory->getBridgeClassNames() as $bridgeClassName) {
$bridge = $bridgeFactory->create($bridgeClassName);
$list->bridges[$bridgeClassName] = [
'status' => $bridgeFactory->isEnabled($bridgeClassName) ? 'active' : 'inactive',
'uri' => $bridge->getURI(),
'donationUri' => $bridge->getDonationURI(),
'name' => $bridge->getName(),
'icon' => $bridge->getIcon(),
'parameters' => $bridge->getParameters(),
'maintainer' => $bridge->getMaintainer(),
'description' => $bridge->getDescription()
2019-02-06 20:34:51 +03:00
];
}
$list->total = count($list->bridges);
return new Response(Json::encode($list), 200, ['content-type' => 'application/json']);
2019-02-06 20:34:51 +03:00
}
}