You are here

protected static function IgnoreFilter::wildcardMatch in Config Ignore 8.2

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.

2 calls to IgnoreFilter::wildcardMatch()
IgnoreFilter::activeRead in src/Plugin/ConfigFilter/IgnoreFilter.php
Read from the active configuration.
IgnoreFilter::matchConfigName in src/Plugin/ConfigFilter/IgnoreFilter.php
Match a config entity name against the list of ignored config entities.

File

src/Plugin/ConfigFilter/IgnoreFilter.php, line 253

Class

IgnoreFilter
Provides a ignore filter that reads partly from the active storage.

Namespace

Drupal\config_ignore\Plugin\ConfigFilter

Code

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