src/Graviton/CoreBundle/Controller/MainController.php
protected function determineServices(array $optionRoutes)
    {
        $router = $this->router;
        foreach ($this->addditionalRoutes as $route) {
            $optionRoutes[$route] = null;
        }

        $services = array_map(
            function ($routeName) use ($router) {
                $routeParts = explode('.', $routeName);
                if (count($routeParts) > 3) {
                    list($app, $bundle, $rest, $document) = $routeParts;

                    $schemaRoute = implode('.', [$app, $bundle, $rest, $document, 'canonicalSchema']);

                    return [
                        '$ref' => $router->generate($routeName, [], UrlGeneratorInterface::ABSOLUTE_URL),
                        'profile' => $router->generate($schemaRoute, [], UrlGeneratorInterface::ABSOLUTE_URL),
                    ];
                }
            },
            array_keys($optionRoutes)
        );

        $sortArr = [];
        foreach ($services as $key => $val) {
            if ($this->isRelevantForMainPage($val) && !in_array($val['$ref'], $sortArr)) {
                $sortArr[$key] = $val['$ref'];
            } else {
                unset($services[$key]);
            }
        }

        // get additional routes
        $additionalRoutes = $this->getAdditionalRoutes($sortArr);

        $services = array_merge($services, $additionalRoutes);

        array_multisort($sortArr, SORT_ASC, $services);
        return $services;
    }
protected function determineServices(array $optionRoutes)
    {
        $router = $this->router;
        foreach ($this->addditionalRoutes as $route) {
            $optionRoutes[$route] = null;
        }

        $services = array_map(
            function ($routeName) use ($router) {
                $routeParts = explode('.', $routeName);
                if (count($routeParts) > 3) {
                    list($app, $bundle, $rest, $document) = $routeParts;

                    $schemaRoute = implode('.', [$app, $bundle, $rest, $document, 'canonicalSchema']);

                    return [
                        '$ref' => $router->generate($routeName, [], UrlGeneratorInterface::ABSOLUTE_URL),
                        'profile' => $router->generate($schemaRoute, [], UrlGeneratorInterface::ABSOLUTE_URL),
                    ];
                }
            },
            array_keys($optionRoutes)
        );

        $sortArr = [];
        foreach ($services as $key => $val) {
            if ($this->isRelevantForMainPage($val) && !in_array($val['$ref'], $sortArr)) {
                $sortArr[$key] = $val['$ref'];
            } else {
                unset($services[$key]);
            }
        }

        // get additional routes
        $additionalRoutes = $this->getAdditionalRoutes($sortArr);

        $services = array_merge($services, $additionalRoutes);

        array_multisort($sortArr, SORT_ASC, $services);
        return $services;
    }
protected function determineServices ( array $ optionRoutes ) { $ router = $ this -> router ; foreach ( $ this -> addditionalRoutes as $ route ) { $ optionRoutes [ $ route ] = null ; } $ services = array_map ( function ( $ routeName ) use ( $ router ) { $ routeParts = explode ( '.' , $ routeName ) ; if ( count ( $ routeParts ) > 3 ) { list ( $ app , $ bundle , $ rest , $ document ) = $ routeParts ; $ schemaRoute = implode ( '.' , [ $ app , $ bundle , $ rest , $ document , 'canonicalSchema' ] ) ; return [ '$ref' => $ router -> generate ( $ routeName , [ ] , UrlGeneratorInterface :: ABSOLUTE_URL ) , 'profile' => $ router -> generate ( $ schemaRoute , [ ] , UrlGeneratorInterface :: ABSOLUTE_URL ) , ] ; } } , array_keys ( $ optionRoutes ) ) ; $ sortArr = [ ] ; foreach ( $ services as $ key => $ val ) { if ( $ this -> isRelevantForMainPage ( $ val ) && ! in_array ( $ val [ '$ref' ] , $ sortArr ) ) { $ sortArr [ $ key ] = $ val [ '$ref' ] ; } else { unset ( $ services [ $ key ] ) ; } } // get additional routes $ additionalRoutes = $ this -> getAdditionalRoutes ( $ sortArr ) ; $ services = array_merge ( $ services , $ additionalRoutes ) ; array_multisort ( $ sortArr , SORT_ASC , $ services ) ; return $ services ; }
Determines what service endpoints are available.

@param array $optionRoutes List of routing options.

@return array
Determines what service endpoints are available .