2019-02-06 18:34:51 +01:00
|
|
|
<?php
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2022-06-22 18:30:37 +02:00
|
|
|
class ListAction implements ActionInterface
|
|
|
|
{
|
2024-01-25 16:06:24 +01:00
|
|
|
public function execute(Request $request)
|
2019-02-06 18:34:51 +01:00
|
|
|
{
|
2022-08-06 22:46:28 +02:00
|
|
|
$list = new \stdClass();
|
2019-02-06 18:34:51 +01:00
|
|
|
$list->bridges = [];
|
|
|
|
$list->total = 0;
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2022-08-06 22:46:28 +02:00
|
|
|
$bridgeFactory = new BridgeFactory();
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2022-07-08 12:54:23 +02:00
|
|
|
foreach ($bridgeFactory->getBridgeClassNames() as $bridgeClassName) {
|
|
|
|
$bridge = $bridgeFactory->create($bridgeClassName);
|
2022-07-01 15:10:30 +02:00
|
|
|
|
2022-07-08 12:54:23 +02:00
|
|
|
$list->bridges[$bridgeClassName] = [
|
2023-10-01 19:23:30 +02:00
|
|
|
'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);
|
2023-09-10 21:50:15 +02:00
|
|
|
return new Response(Json::encode($list), 200, ['content-type' => 'application/json']);
|
2019-02-06 18:34:51 +01:00
|
|
|
}
|
|
|
|
}
|