Platformsh\Cli\Command\Environment\EnvironmentRoutesCommand::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->validateInput($input);
        $environment = $this->getSelectedEnvironment();
        $routes = $environment->getRoutes();
        if (empty($routes)) {
            $this->stdErr->writeln("No routes found");
            return 0;
        }
        $table = new Table($input, $output);
        $header = ['Route', 'Type', 'To', 'Cache', 'SSI'];
        $rows = [];
        foreach ($routes as $route) {
            $rows[] = [$route->id, $route->type, $route->type == 'upstream' ? $route->upstream : $route->to, json_encode($route->cache), json_encode($route->ssi)];
        }
        if (!$table->formatIsMachineReadable()) {
            $this->stdErr->writeln("Routes for the environment <info>{$environment->id}</info>:");
        }
        $table->render($rows, $header);
        return 0;
    }
EnvironmentRoutesCommand