/**
  * @param ConsoleExceptionEvent $event
  */
 public function onConsoleException(ConsoleExceptionEvent $event)
 {
     $exception = $event->getException();
     $metadata = new Metadata();
     $metadata->addMetadatum('commandName', $event->getInput()->getFirstArgument());
     $metadata->addMetadatum('command', (string) $event->getInput());
     $metadata->addMetadatum('exitCode', $event->getExitCode());
     $this->errorHandler->handleException($exception, $metadata);
 }
 /** {@inheritdoc} */
 public function process(Metadata $metadata, \Exception $exception = null)
 {
     $metadata->addTag('php_version', phpversion());
     $metadata->addMetadatum('php_version', phpversion());
     $metadata->addTag('php_sapi_name', php_sapi_name());
     $metadata->addMetadatum('php_sapi_name', php_sapi_name());
     $metadata->addTag('hostname', gethostname());
     $metadata->addMetadatum('hostname', gethostname());
 }
 /** {@inheritdoc} */
 public function process(Metadata $metadata, \Exception $exception = null)
 {
     $metadata->setStage($this->environment);
     $metadata->addTag('symfony_version', Kernel::VERSION);
     $metadata->addMetadatum('symfony_version', Kernel::VERSION);
     $metadata->setAppRootDir($this->kernelRootDir);
 }
 /**
  * @param Metadata $metadata
  *
  * @return string
  */
 protected function calculateGroupingHash(Metadata $metadata)
 {
     $grouping = $metadata->getGrouping();
     if (!$grouping) {
         return '';
     }
     $dataToHash = '';
     foreach ($grouping as $name => $value) {
         $dataToHash .= sprintf('%s=%s', $name, serialize($value));
     }
     $groupingHash = md5($dataToHash);
     $metadata->addMetadatum('grouping_hash', $groupingHash);
     return $groupingHash;
 }
 /** {@inheritdoc} */
 public function process(Metadata $metadata, \Exception $exception = null)
 {
     $this->callbackExecuted = true;
     $metadata->setAppRootDir('app_root_dir');
     $metadata->setStage('stage');
     $metadata->setAppVersion('app_version');
     $metadata->addTags(array('tag1' => 1, 'tag3' => 3));
     $metadata->addTag('tag2', 2);
     $metadata->removeTag('tag3');
     $metadata->addMetadata(array('metadatum1' => 1, 'metadatum3' => 3));
     $metadata->addMetadatum('metadatum2', 2);
     $metadata->removeMetadatum('metadatum3');
     $metadata->addCategories(array('category1', 'category2'));
     $metadata->addCategory('category3');
     $metadata->removeCategory('category3');
     $metadata->addGrouping(array('group1' => 'value1'));
     $metadata->groupBy('group1', 'value2');
     $metadata->groupBy('group2', 'value2');
 }