You are here

public static function ConversionHelper::findTokensNeededForTemplate in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_servers/src/Helper/ConversionHelper.php \Drupal\ldap_servers\Helper\ConversionHelper::findTokensNeededForTemplate()

Find the tokens needed for the template.

Parameters

string $template: In the form of [cn]@myuniversity.edu.

Return value

array Array of all tokens in the template such as array('cn').

1 call to ConversionHelper::findTokensNeededForTemplate()
LdapEntryProvisionSubscriber::fetchDrupalAttributeValue in ldap_user/src/EventSubscriber/LdapEntryProvisionSubscriber.php
Replace a single token.

File

ldap_servers/src/Helper/ConversionHelper.php, line 124

Class

ConversionHelper
Conversion helper to escape values correctly for LDAP filters.

Namespace

Drupal\ldap_servers\Helper

Code

public static function findTokensNeededForTemplate(string $template) : array {
  preg_match_all('/
    \\[             # [ - pattern start
    ([^\\[\\]]*)  # match $type not containing whitespace : [ or ]
    \\]             # ] - pattern end
    /x', $template, $matches);
  return @$matches[1];
}