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 18:34:51 +01:00
<?php
2022-06-22 18:30:37 +02:00
class ListAction implements ActionInterface
{
public function execute(array $request)
2019-02-06 18:34:51 +01:00
{
$list = new \stdClass();
2019-02-06 18:34:51 +01: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 18:34:51 +01:00
];
}
$list->total = count($list->bridges);
return new Response(Json::encode($list), 200, ['content-type' => 'application/json']);
2019-02-06 18:34:51 +01:00
}
}