for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace KunicMarko\SonataAnnotationBundle\Reader;
use Doctrine\Common\Annotations\Reader;
use KunicMarko\SonataAnnotationBundle\Annotation\Route;
use Sonata\AdminBundle\Route\RouteCollection;
/**
* @author Marko Kunic <[email protected]>
*/
class RouteReader
{
use AnnotationReaderTrait;
public function getRoutes(\ReflectionClass $class): array
$routes = [];
foreach ($this->getClassAnnotations($class) as $annotation) {
if (!$this->isSupported($annotation)) {
continue;
}
$routes[$annotation->name] = $annotation;
return $routes;
private function isSupported($annotation): bool
return $annotation instanceof Route;