public function getRoutes(string ...$classes): array
    {
        $routes = $this->getClassRoutes($classes);
        /** @var \Valkyrja\Routing\Route[] $finalRoutes */
        $finalRoutes = [];

        // Iterate through all the routes
        foreach ($routes as $route) {
            // Set the route's properties
            $this->setRouteProperties($route);

            $classAnnotations = $this->classAnnotationsType(
                $this->routeAnnotationType,
                $route->getClass()
            );

            // If this route's class has annotations
            if ($classAnnotations) {
                /** @var Route $annotation */
                // Iterate through all the annotations
                foreach ($classAnnotations as $annotation) {
                    // And set a new route with the controller defined annotation additions
                    $finalRoutes[] =
                        $this->getRouteFromAnnotation(
                            $this->getControllerBuiltRoute($annotation, $route)
                        );
                }
            } else {
                // Validate the path before setting the route
                $route->setPath($this->validatePath($route->getPath()));

                // Otherwise just set the route in the final array
                $finalRoutes[] = $this->getRouteFromAnnotation($route);
            }
        }

        return $finalRoutes;
    }
public function getRoutes(string ...$classes): array
    {
        $routes = $this->getClassRoutes($classes);
        /** @var \Valkyrja\Routing\Route[] $finalRoutes */
        $finalRoutes = [];

        // Iterate through all the routes
        foreach ($routes as $route) {
            // Set the route's properties
            $this->setRouteProperties($route);

            $classAnnotations = $this->classAnnotationsType(
                $this->routeAnnotationType,
                $route->getClass()
            );

            // If this route's class has annotations
            if ($classAnnotations) {
                /** @var Route $annotation */
                // Iterate through all the annotations
                foreach ($classAnnotations as $annotation) {
                    // And set a new route with the controller defined annotation additions
                    $finalRoutes[] =
                        $this->getRouteFromAnnotation(
                            $this->getControllerBuiltRoute($annotation, $route)
                        );
                }
            } else {
                // Validate the path before setting the route
                $route->setPath($this->validatePath($route->getPath()));

                // Otherwise just set the route in the final array
                $finalRoutes[] = $this->getRouteFromAnnotation($route);
            }
        }

        return $finalRoutes;
    }
public function getRoutes ( string ... $ classes ) : array { $ routes = $ this -> getClassRoutes ( $ classes ) ; /** @var \Valkyrja\Routing\Route[] $finalRoutes */ $ finalRoutes = [ ] ; // Iterate through all the routes foreach ( $ routes as $ route ) { // Set the route's properties $ this -> setRouteProperties ( $ route ) ; $ classAnnotations = $ this -> classAnnotationsType ( $ this -> routeAnnotationType , $ route -> getClass ( ) ) ; // If this route's class has annotations if ( $ classAnnotations ) { /** @var Route $annotation */ // Iterate through all the annotations foreach ( $ classAnnotations as $ annotation ) { // And set a new route with the controller defined annotation additions $ finalRoutes [ ] = $ this -> getRouteFromAnnotation ( $ this -> getControllerBuiltRoute ( $ annotation , $ route ) ) ; } } else { // Validate the path before setting the route $ route -> setPath ( $ this -> validatePath ( $ route -> getPath ( ) ) ) ; // Otherwise just set the route in the final array $ finalRoutes [ ] = $ this -> getRouteFromAnnotation ( $ route ) ; } } return $ finalRoutes ; }
Get routes.

@param string[] $classes The classes

@throws \InvalidArgumentException
@throws \ReflectionException
@throws \Valkyrja\Routing\Exceptions\InvalidRoutePath

@return \Valkyrja\Routing\Route[]
Get routes .