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 KunicMarko\SonataAnnotationBundle\Annotation\AddRoute;
use KunicMarko\SonataAnnotationBundle\Annotation\RemoveRoute;
/**
* @author Marko Kunic <[email protected]>
*/
class RouteReader
{
use AnnotationReaderTrait;
public function getRoutes(\ReflectionClass $class): array
$addRoutes = [];
$removeRoutes = [];
foreach ($this->getClassAnnotations($class) as $annotation) {
if ($this->isAddRoute($annotation)) {
$addRoutes[$annotation->name] = $annotation;
continue;
}
if ($this->isRemoveRoute($annotation)) {
$removeRoutes[$annotation->name] = $annotation;
return [$addRoutes, $removeRoutes];
private function isAddRoute($annotation): bool
return $annotation instanceof AddRoute;
private function isRemoveRoute($annotation): bool
return $annotation instanceof RemoveRoute;