You are here

protected static function GoogleAdwordsPathTrackerBackup::_matchPath_recursive in Google AdWords Conversion Tracking 8

Navigate down the path tree to try to match the path to a node in the tree

Parameters

array $tree:

array $path:

Return value

array configs that match the path

1 call to GoogleAdwordsPathTrackerBackup::_matchPath_recursive()
GoogleAdwordsPathTrackerBackup::matchPath in modules/google_adwords_path/src/GoogleAdwordsPathTracker.backup.php

File

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

Class

GoogleAdwordsPathTrackerBackup
Class GoogleAdwordsPathTracker.

Namespace

Drupal\google_adwords_path

Code

protected static function _matchPath_recursive(array $tree, array $path) {
  if (count($path) === 0) {
    if (isset($tree[static::GOOGLE_ADWORDS_PATH_TREE_NODEKEY])) {
      return $tree[static::GOOGLE_ADWORDS_PATH_TREE_NODEKEY];
    }
    return [];
  }
  else {
    $pathElement = array_pop($path);
    if (isset($tree[$pathElement])) {
      return static::_matchPath_recursive($tree[$pathElement], $path);
    }
    else {
      return [];
    }
  }
}