src/Viserio/Component/Routing/TreeGenerator/RouteTreeCompiler.php
public function compile(array $routes): string
    {
        $routeTree = $this->treeOptimizer->optimize(
            $this->treeBuilder->build($routes)
        );

        $code         = new PHPCodeCollection();
        $code->indent = 1;

        $this->compileRouteTree($code, $routeTree);

        $rootRouteCode         = new PHPCodeCollection();
        $rootRouteCode->indent = 2;

        $this->compileNotFound($rootRouteCode);

        return $this->createRouterClassTemplate(\substr($rootRouteCode->code, 0, -\strlen(\PHP_EOL)), $code->code);
    }
public function compile(array $routes): string
    {
        $routeTree = $this->treeOptimizer->optimize(
            $this->treeBuilder->build($routes)
        );

        $code         = new PHPCodeCollection();
        $code->indent = 1;

        $this->compileRouteTree($code, $routeTree);

        $rootRouteCode         = new PHPCodeCollection();
        $rootRouteCode->indent = 2;

        $this->compileNotFound($rootRouteCode);

        return $this->createRouterClassTemplate(\substr($rootRouteCode->code, 0, -\strlen(\PHP_EOL)), $code->code);
    }
Complie all added routes to a router handler.

@param array $routes

@return string