<?php
/*
* This file is part of the nellapp-core package.
*
* (c) Benjamin Georgeault
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nellapp\Bundle\SDKBundle\Sync\Routing\Controller\Sync;
use Drosalys\Bundle\ApiBundle\Routing\Attributes\Get;
use Drosalys\Bundle\ApiBundle\Serializer\Attributes\Serializable;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RouterInterface;
/**
* Class CollectionAction
*
* @author Benjamin Georgeault
*/
class CollectionAction
{
public function __construct(
private RouterInterface $router,
) {}
#[Get('/routes', name: 'nellapp_sdk_routing_routes')]
#[Serializable('Sync')]
#[IsGranted('ROLE_USER')]
public function __invoke(): array
{
return array_filter($this->router->getRouteCollection()->all(), function (string $routeName) {
return !preg_match('/^(_)|(nellapp_sdk)/', $routeName);
}, ARRAY_FILTER_USE_KEY);
}
}