mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-25 10:56:18 +03:00
41df17bc46
* test: refactor test suite * docs * refactor * yup * docs
30 lines
1.1 KiB
PHP
30 lines
1.1 KiB
PHP
<?php
|
|
|
|
class ListAction implements ActionInterface
|
|
{
|
|
public function execute(array $request)
|
|
{
|
|
$list = new \stdClass();
|
|
$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()
|
|
];
|
|
}
|
|
$list->total = count($list->bridges);
|
|
return new Response(Json::encode($list), 200, ['content-type' => 'application/json']);
|
|
}
|
|
}
|