/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $file = null; if ($input->hasOption('file')) { $file = $input->getOption('file'); } $data = $this->getApplication()->getData(); if ($file) { file_put_contents($file, json_encode($data, JSON_PRETTY_PRINT)); return 0; } $io->write(json_encode($data, JSON_PRETTY_PRINT)); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $sitesDirectory = $this->configurationManager->getSitesDirectory(); if (!is_dir($sitesDirectory)) { $io->error(sprintf($this->trans('commands.site.debug.messages.directory-not-found'), $sitesDirectory)); return 1; } // --target argument $target = $input->getArgument('target'); if ($target) { $io->write($this->siteDetail($target)); return 0; } $tableHeader = [$this->trans('commands.site.debug.messages.site'), $this->trans('commands.site.debug.messages.host'), $this->trans('commands.site.debug.messages.root')]; $tableRows = $this->siteList($sitesDirectory); $io->table($tableHeader, $tableRows); return 0; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $service = $input->getArgument('service'); $parameters = $input->getOption('parameters'); if ($parameters) { $parameterList = $this->getParameterList(); ksort($parameterList); $io->write(Yaml::dump(['parameters' => $parameterList], 4, 2)); return 0; } $tableHeader = []; if ($service) { $tableRows = $this->getServiceDetail($service); $io->table($tableHeader, $tableRows, 'compact'); return 0; } $tableHeader = [$this->trans('commands.container.debug.messages.service_id'), $this->trans('commands.container.debug.messages.class_name')]; $tableRows = $this->getServiceList(); $io->table($tableHeader, $tableRows, 'compact'); return 0; }