You are here

public function BusinessRulesProcessor::saveDebugInfo in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Util/BusinessRulesProcessor.php \Drupal\business_rules\Util\BusinessRulesProcessor::saveDebugInfo()

Save the debug information.

1 call to BusinessRulesProcessor::saveDebugInfo()
BusinessRulesProcessor::process in src/Util/BusinessRulesProcessor.php
Process rules.

File

src/Util/BusinessRulesProcessor.php, line 281

Class

BusinessRulesProcessor
Class BusinessRulesProcessor.

Namespace

Drupal\business_rules\Util

Code

public function saveDebugInfo() {
  if ($this->config
    ->get('debug_screen')) {
    $array = $this
      ->getDebugRenderArray();
    $key_value = $this->util
      ->getKeyValueExpirable('debug');
    $session_id = session_id();
    $current = $key_value
      ->get($session_id);
    if (isset($current['triggered_rules']) && count($current['triggered_rules'])) {
      foreach ($current['triggered_rules'] as $key => $item) {
        $array['triggered_rules'][$key] = $item;
      }
    }
    $array = (object) $array;
    $event = new Event($array);

    // Dispatch a event before save debug info block.
    $this->eventDispatcher
      ->dispatch('business_rules.before_save_debug_info_block', $event);
    $array = (array) $array;
    $key_value
      ->set($session_id, $array);
  }
}