You are here

protected static function ConfigSplitManager::inFilterList in Configuration Split 2.0.x

Check whether the needle is in the haystack.

Parameters

string $name: The needle which is checked.

string[] $list: The haystack, a list of identifiers to determine whether $name is in it.

Return value

bool True if the name is considered to be in the list.

1 call to ConfigSplitManager::inFilterList()
ConfigSplitManager::splitPreview in src/ConfigSplitManager.php
Split the config of a split to the preview storage.

File

src/ConfigSplitManager.php, line 735

Class

ConfigSplitManager
The manager to split and merge.

Namespace

Drupal\config_split

Code

protected static function inFilterList($name, array $list) {

  // Prepare the list for regex matching by quoting all regex symbols and
  // replacing back the original '*' with '.*' to allow it to catch all.
  $list = array_map(function ($line) {
    return str_replace('\\*', '.*', preg_quote($line, '/'));
  }, $list);
  foreach ($list as $line) {
    if (preg_match('/^' . $line . '$/', $name)) {
      return TRUE;
    }
  }
  return FALSE;
}