function ExportCommand::execute

File

webprofiler/src/Command/ExportCommand.php, line 45

Class

ExportCommand
Class ExportCommand

Namespace

Drupal\webprofiler\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) {
    $id = $input->getArgument('id');
    $directory = $input->getOption('directory');
    
    /** @var \Drupal\webprofiler\Profiler\Profiler $profiler */
    $profiler = $this->container
        ->get('profiler');
    try {
        if ($id) {
            $this->filename = $this->exportSingle($profiler, $id, $directory);
        }
        else {
            $this->filename = $this->exportAll($profiler, $directory, $output);
        }
    } catch (\Exception $e) {
        $output->writeln('<error>' . $e->getMessage() . '</error>');
    }
}