You are here

public static function ConfigActionsTransform::read in Config Actions 8

walk a tree and return what is at the end of the path

Parameters

array $tree : the tree to walk:

array $path : an array of keys to walk in the tree:

Return value

mixed: what ever is at the end of the path through the tree

3 calls to ConfigActionsTransform::read()
ConfigActionsTransform::add in src/ConfigActionsTransform.php
Walk a tree and add a value at the end of the path
ConfigActionsTransformTest::testRead in tests/src/Unit/ConfigActionsTransformTest.php
@covers ::read
ConfigActionsValidateTrait::validatePath in src/ConfigActionsValidateTrait.php
Perform validation of the path. Call this from the plugin transform or execute method. Throws exception if validation fails.

File

src/ConfigActionsTransform.php, line 198

Class

ConfigActionsTransform
Perform transformations on data needed for config_actions plugins

Namespace

Drupal\config_actions

Code

public static function read(array $tree, array $path) {
  return array_reduce($path, function ($carry, $key) {
    return isset($carry[$key]) ? $carry[$key] : NULL;
  }, $tree);
}