You are here

private static function ConfigEntityProvider::schemeToRegex in oEmbed 8

Parameters

$schemes:

bool|FALSE $capture_subpatterns:

Return value

string

1 call to ConfigEntityProvider::schemeToRegex()
ConfigEntityProvider::supports in src/Provider/ConfigEntityProvider.php
Returns whether this class supports the given url.

File

src/Provider/ConfigEntityProvider.php, line 96

Class

ConfigEntityProvider

Namespace

Drupal\oembed\Provider

Code

private static function schemeToRegex($schemes, $capture_subpatterns = FALSE) {
  $patterns = array_map(function ($scheme) use ($capture_subpatterns) {
    return str_replace('\\*', $capture_subpatterns ? '(.*)' : '.*', preg_quote($scheme, '#'));
  }, $schemes);
  return '#' . implode('|', $patterns) . '#i';
}