private function doDump(OutputInterface $output)
    {
        if (!is_dir($dir = dirname($this->targetPath))) {
            $output->writeln('<info>[dir+]</info>  ' . $dir);
            if (false === @mkdir($dir, 0777, true)) {
                throw new \RuntimeException('Unable to create directory ' . $dir);
            }
        }

        $output->writeln('<info>[file+]</info> ' . $this->targetPath);

        $templates = [
            'js' => "this.%s = route('%s');\n",
            'es6' => "\t\t\t'%s': '%s',\n"
        ];

        $type = $this->parameterBag->get('netbull_core.js_type');

        $routes = '';
        foreach ($this->extractor->getRoutes() as $name => $route) {
            preg_match_all("/{(.*?)}/i", $route->getPath(), $routeParams);

            if (0 < count($routeParams)) {
                $parameters = array_flip($routeParams[1]);
                $normalizedRoute = preg_replace_callback("/{(.*?)}/i", function($m) use($parameters) {
                    return ':' . ($parameters[$m[1]] + 1);
                }, $route->getPath());

                $routes .= sprintf($templates[$type], $name, $normalizedRoute);
            }
        }

        $source = file_get_contents(__DIR__ . '/../Resources/js/router.' . $type . '.js');
        $content = str_replace('//<ROUTES>', $routes, $source);

        if (false === @file_put_contents($this->targetPath, $content)) {
            throw new \RuntimeException('Unable to write file ' . $this->targetPath);
        }
    }
private function doDump(OutputInterface $output)
    {
        if (!is_dir($dir = dirname($this->targetPath))) {
            $output->writeln('<info>[dir+]</info>  ' . $dir);
            if (false === @mkdir($dir, 0777, true)) {
                throw new \RuntimeException('Unable to create directory ' . $dir);
            }
        }

        $output->writeln('<info>[file+]</info> ' . $this->targetPath);

        $templates = [
            'js' => "this.%s = route('%s');\n",
            'es6' => "\t\t\t'%s': '%s',\n"
        ];

        $type = $this->parameterBag->get('netbull_core.js_type');

        $routes = '';
        foreach ($this->extractor->getRoutes() as $name => $route) {
            preg_match_all("/{(.*?)}/i", $route->getPath(), $routeParams);

            if (0 < count($routeParams)) {
                $parameters = array_flip($routeParams[1]);
                $normalizedRoute = preg_replace_callback("/{(.*?)}/i", function($m) use($parameters) {
                    return ':' . ($parameters[$m[1]] + 1);
                }, $route->getPath());

                $routes .= sprintf($templates[$type], $name, $normalizedRoute);
            }
        }

        $source = file_get_contents(__DIR__ . '/../Resources/js/router.' . $type . '.js');
        $content = str_replace('//<ROUTES>', $routes, $source);

        if (false === @file_put_contents($this->targetPath, $content)) {
            throw new \RuntimeException('Unable to write file ' . $this->targetPath);
        }
    }
private function doDump ( OutputInterface $ output ) { if ( ! is_dir ( $ dir = dirname ( $ this -> targetPath ) ) ) { $ output -> writeln ( '<info>[dir+]</info>  ' . $ dir ) ; if ( false === @ mkdir ( $ dir , 0777 , true ) ) { throw new \ RuntimeException ( 'Unable to create directory ' . $ dir ) ; } } $ output -> writeln ( '<info>[file+]</info> ' . $ this -> targetPath ) ; $ templates = [ 'js' => "this.%s = route('%s');\n" , 'es6' => "\t\t\t'%s': '%s',\n" ] ; $ type = $ this -> parameterBag -> get ( 'netbull_core.js_type' ) ; $ routes = '' ; foreach ( $ this -> extractor -> getRoutes ( ) as $ name => $ route ) { preg_match_all ( "/{(.*?)}/i" , $ route -> getPath ( ) , $ routeParams ) ; if ( 0 < count ( $ routeParams ) ) { $ parameters = array_flip ( $ routeParams [ 1 ] ) ; $ normalizedRoute = preg_replace_callback ( "/{(.*?)}/i" , function ( $ m ) use ( $ parameters ) { return ':' . ( $ parameters [ $ m [ 1 ] ] + 1 ) ; } , $ route -> getPath ( ) ) ; $ routes .= sprintf ( $ templates [ $ type ] , $ name , $ normalizedRoute ) ; } } $ source = file_get_contents ( __DIR__ . '/../Resources/js/router.' . $ type . '.js' ) ; $ content = str_replace ( '//<ROUTES>' , $ routes , $ source ) ; if ( false === @ file_put_contents ( $ this -> targetPath , $ content ) ) { throw new \ RuntimeException ( 'Unable to write file ' . $ this -> targetPath ) ; } }
Performs the routes dump.

@param OutputInterface $output The command output
Performs the routes dump .