You are here

public function GoogleAdwordsPathTracker::buildPathTree in Google AdWords Conversion Tracking 8

Retrieve the path tree from cache, or ask for it to be rebuild

Parameters

boolean $reset: Invalidate the cache

Return value

array A path tree similar to a render tree, with an element per path argument

1 call to GoogleAdwordsPathTracker::buildPathTree()
GoogleAdwordsPathTracker::matchPath in modules/google_adwords_path/src/GoogleAdwordsPathTracker.php
Try to match a single path to PathCongifs

File

modules/google_adwords_path/src/GoogleAdwordsPathTracker.php, line 301
Contains Drupal\google_adwords_path\GoogleAdwordsPathTracker.

Class

GoogleAdwordsPathTracker
Class GoogleAdwordsPathTracker.

Namespace

Drupal\google_adwords_path

Code

public function buildPathTree($reset = FALSE) {

  /**
   * @var array $tree
   *   path tree
   */
  $tree = [];

  /**
   * @var object|false $cache
   */
  $cache = false;
  if (!$reset) {
    $cache = $this->cache_data
      ->get(self::GOOGLE_ADWORDS_PATH_TREE_CACHE_CID);
  }
  if ($cache === FALSE) {
    $tree = $this
      ->_buildPathTree();
    $this->cache_data
      ->set(self::GOOGLE_ADWORDS_PATH_TREE_CACHE_CID, $tree, CacheBackendInterface::CACHE_PERMANENT);
  }
  else {
    $tree = $cache->data;
  }
  if (is_array($tree)) {
    return $tree;
  }
  else {
    return [];
  }
}