You are here

protected function ConfigIgnoreEventSubscriber::wildcardMatch in Config Ignore 8.3

Checks if a string matches a given wildcard pattern.

Parameters

string $pattern: The wildcard pattern to me matched.

string $string: The string to be checked.

Return value

bool TRUE if $string string matches the $pattern pattern.

1 call to ConfigIgnoreEventSubscriber::wildcardMatch()
ConfigIgnoreEventSubscriber::getIgnoredConfigs in src/EventSubscriber/ConfigIgnoreEventSubscriber.php
Returns the list of all ignored configs by expanding the wildcards.

File

src/EventSubscriber/ConfigIgnoreEventSubscriber.php, line 261

Class

ConfigIgnoreEventSubscriber
Makes the import/export aware of ignored configs.

Namespace

Drupal\config_ignore\EventSubscriber

Code

protected function wildcardMatch($pattern, $string) {
  $pattern = '/^' . preg_quote($pattern, '/') . '$/';
  $pattern = str_replace('\\*', '.*', $pattern);
  return (bool) preg_match($pattern, $string);
}