You are here

protected function ExportCommand::execute in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Command/ExportCommand.php \Drupal\webprofiler\Command\ExportCommand::execute()
  2. 8.2 webprofiler/src/Command/ExportCommand.php \Drupal\webprofiler\Command\ExportCommand::execute()
  3. 4.x webprofiler/src/Command/ExportCommand.php \Drupal\webprofiler\Command\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>');
  }
}