public function analyzeController(string $controllerInstanceName) : array
    {
        // Let's analyze the controller and get all the @Action annotations:
        $urlsList = array();

        $controller = $this->container->get($controllerInstanceName);

        $refClass = new \ReflectionClass($controller);

        foreach ($refClass->getMethods() as $refMethod) {
            $title = null;
            // Now, let's check the "Title" annotation (note: we do not support multiple title annotations for the same method)
            /** @var Title */
            $titleAnnotation = $this->annotationReader->getMethodAnnotation($refMethod, Title::class);
            if ($titleAnnotation !== null) {
                $title = $titleAnnotation->getTitle();
            }

            // First, let's check the "Action" annotation
            $actionAnnotation = $this->annotationReader->getMethodAnnotation($refMethod, Action::class);
            if ($actionAnnotation !== null) {
                $methodName = $refMethod->getName();
                if ($methodName === 'index') {
                    $url = $controllerInstanceName.'/';
                } else {
                    $url = $controllerInstanceName.'/'.$methodName;
                }
                $parameters = $this->parameterFetcherRegistry->mapParameters($refMethod);
                $filters = FilterUtils::getFilters($refMethod, $this->annotationReader);
                $urlsList[] = new SplashRoute($url, $controllerInstanceName, $refMethod->getName(), $title, $refMethod->getDocComment(), $this->getSupportedHttpMethods($refMethod), $parameters, $filters, $refClass->getFileName());
            }

            // Now, let's check the "URL" annotation (note: we support multiple URL annotations for the same method)
            $annotations = $this->annotationReader->getMethodAnnotations($refMethod);

            foreach ($annotations as $annotation) {
                if (!$annotation instanceof URL) {
                    continue;
                }

                /* @var $annotation URL */
                $url = $annotation->getUrl();

                // Get public properties if they exist in the URL
                if (preg_match_all('/[^{]*{\$this->([^\/]*)}[^{]*/', $url, $output)) {
                    foreach ($output[1] as $param) {
                        $value = $this->readPrivateProperty($controller, $param);
                        $url = str_replace('{$this->'.$param.'}', $value, $url);
                    }
                }

                $url = ltrim($url, '/');
                $parameters = $this->parameterFetcherRegistry->mapParameters($refMethod, $url);
                $filters = FilterUtils::getFilters($refMethod, $this->annotationReader);
                $urlsList[] = new SplashRoute($url, $controllerInstanceName, $refMethod->getName(), $title, $refMethod->getDocComment(), $this->getSupportedHttpMethods($refMethod), $parameters, $filters, $refClass->getFileName());
            }
        }

        return $urlsList;
    }
public function analyzeController(string $controllerInstanceName) : array
    {
        // Let's analyze the controller and get all the @Action annotations:
        $urlsList = array();

        $controller = $this->container->get($controllerInstanceName);

        $refClass = new \ReflectionClass($controller);

        foreach ($refClass->getMethods() as $refMethod) {
            $title = null;
            // Now, let's check the "Title" annotation (note: we do not support multiple title annotations for the same method)
            /** @var Title */
            $titleAnnotation = $this->annotationReader->getMethodAnnotation($refMethod, Title::class);
            if ($titleAnnotation !== null) {
                $title = $titleAnnotation->getTitle();
            }

            // First, let's check the "Action" annotation
            $actionAnnotation = $this->annotationReader->getMethodAnnotation($refMethod, Action::class);
            if ($actionAnnotation !== null) {
                $methodName = $refMethod->getName();
                if ($methodName === 'index') {
                    $url = $controllerInstanceName.'/';
                } else {
                    $url = $controllerInstanceName.'/'.$methodName;
                }
                $parameters = $this->parameterFetcherRegistry->mapParameters($refMethod);
                $filters = FilterUtils::getFilters($refMethod, $this->annotationReader);
                $urlsList[] = new SplashRoute($url, $controllerInstanceName, $refMethod->getName(), $title, $refMethod->getDocComment(), $this->getSupportedHttpMethods($refMethod), $parameters, $filters, $refClass->getFileName());
            }

            // Now, let's check the "URL" annotation (note: we support multiple URL annotations for the same method)
            $annotations = $this->annotationReader->getMethodAnnotations($refMethod);

            foreach ($annotations as $annotation) {
                if (!$annotation instanceof URL) {
                    continue;
                }

                /* @var $annotation URL */
                $url = $annotation->getUrl();

                // Get public properties if they exist in the URL
                if (preg_match_all('/[^{]*{\$this->([^\/]*)}[^{]*/', $url, $output)) {
                    foreach ($output[1] as $param) {
                        $value = $this->readPrivateProperty($controller, $param);
                        $url = str_replace('{$this->'.$param.'}', $value, $url);
                    }
                }

                $url = ltrim($url, '/');
                $parameters = $this->parameterFetcherRegistry->mapParameters($refMethod, $url);
                $filters = FilterUtils::getFilters($refMethod, $this->annotationReader);
                $urlsList[] = new SplashRoute($url, $controllerInstanceName, $refMethod->getName(), $title, $refMethod->getDocComment(), $this->getSupportedHttpMethods($refMethod), $parameters, $filters, $refClass->getFileName());
            }
        }

        return $urlsList;
    }
public function analyzeController ( string $ controllerInstanceName ) : array { // Let's analyze the controller and get all the @Action annotations: $ urlsList = array ( ) ; $ controller = $ this -> container -> get ( $ controllerInstanceName ) ; $ refClass = new \ ReflectionClass ( $ controller ) ; foreach ( $ refClass -> getMethods ( ) as $ refMethod ) { $ title = null ; // Now, let's check the "Title" annotation (note: we do not support multiple title annotations for the same method) /** @var Title */ $ titleAnnotation = $ this -> annotationReader -> getMethodAnnotation ( $ refMethod , Title :: class ) ; if ( $ titleAnnotation !== null ) { $ title = $ titleAnnotation -> getTitle ( ) ; } // First, let's check the "Action" annotation $ actionAnnotation = $ this -> annotationReader -> getMethodAnnotation ( $ refMethod , Action :: class ) ; if ( $ actionAnnotation !== null ) { $ methodName = $ refMethod -> getName ( ) ; if ( $ methodName === 'index' ) { $ url = $ controllerInstanceName . '/' ; } else { $ url = $ controllerInstanceName . '/' . $ methodName ; } $ parameters = $ this -> parameterFetcherRegistry -> mapParameters ( $ refMethod ) ; $ filters = FilterUtils :: getFilters ( $ refMethod , $ this -> annotationReader ) ; $ urlsList [ ] = new SplashRoute ( $ url , $ controllerInstanceName , $ refMethod -> getName ( ) , $ title , $ refMethod -> getDocComment ( ) , $ this -> getSupportedHttpMethods ( $ refMethod ) , $ parameters , $ filters , $ refClass -> getFileName ( ) ) ; } // Now, let's check the "URL" annotation (note: we support multiple URL annotations for the same method) $ annotations = $ this -> annotationReader -> getMethodAnnotations ( $ refMethod ) ; foreach ( $ annotations as $ annotation ) { if ( ! $ annotation instanceof URL ) { continue ; } /* @var $annotation URL */ $ url = $ annotation -> getUrl ( ) ; // Get public properties if they exist in the URL if ( preg_match_all ( '/[^{]*{\$this->([^\/]*)}[^{]*/' , $ url , $ output ) ) { foreach ( $ output [ 1 ] as $ param ) { $ value = $ this -> readPrivateProperty ( $ controller , $ param ) ; $ url = str_replace ( '{$this->' . $ param . '}' , $ value , $ url ) ; } } $ url = ltrim ( $ url , '/' ) ; $ parameters = $ this -> parameterFetcherRegistry -> mapParameters ( $ refMethod , $ url ) ; $ filters = FilterUtils :: getFilters ( $ refMethod , $ this -> annotationReader ) ; $ urlsList [ ] = new SplashRoute ( $ url , $ controllerInstanceName , $ refMethod -> getName ( ) , $ title , $ refMethod -> getDocComment ( ) , $ this -> getSupportedHttpMethods ( $ refMethod ) , $ parameters , $ filters , $ refClass -> getFileName ( ) ) ; } } return $ urlsList ; }
Returns an array of SplashRoute for the controller passed in parameter.

@return SplashRoute[]

@throws SplashException
Returns an array of SplashRoute for the controller passed in parameter .