code: protected function resolveContextAndNodeHeader(GherkinNodeTested $event)
      {
          $context = [];
          switch (true) {
              case $event instanceof StepTested:
                  $nodeHeader = self::HEADER_NODE_STEP;
                  $context['text'] = $event->getStep()->getText();
                  break;
              case $event instanceof BackgroundTested:
                  $nodeHeader = self::HEADER_NODE_BACKGROUND;
                  $context['title'] = $event->getBackground()->getTitle();
                  break;
              case $event instanceof ScenarioTested:
                  $scenario = $event->getScenario();
                  $nodeHeader = self::HEADER_NODE_SCENARIO;
                  if ($scenario instanceof ExampleNode) {
                      $nodeHeader = self::HEADER_NODE_EXAMPLE;
                      $context['tokens'] = $scenario->getTokens();
                  }
                  $context['title'] = $scenario->getTitle();
                  break;
              case $event instanceof OutlineTested:
                  $nodeHeader = self::HEADER_NODE_OUTLINE;
                  $context['title'] = $event->getOutline()->getTitle();
                  break;
              case $event instanceof FeatureTested:
                  $nodeHeader = self::HEADER_NODE_FEATURE;
                  $context['title'] = $event->getFeature()->getTitle();
                  $context['file'] = $event->getFeature()->getFile();
                  break;
              default:
                  throw new \InvalidArgumentException(sprintf('"%s" not handled !', get_class($event)));
          }
  
          if (!$event instanceof FeatureTested) {
              $context['line'] = $this->resolveNodeLine($event);
          }
  
          return [
              $context,
              $nodeHeader
          ];
      }
docs: @param GherkinNodeTested $event
  
  @return array