You are here

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

Same name and namespace in other branches
  1. 8.4 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').

2 calls to ConversionHelper::findTokensNeededForTemplate()
ConversionHelper::extractTokenAttributes in ldap_servers/src/Helper/ConversionHelper.php
Extract token attributes.
TokenProcessor::tokenReplace in ldap_servers/src/Processor/TokenProcessor.php
Replace a token.

File

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

Class

ConversionHelper
Conversion helper to escape values correctly for LDAP filters.

Namespace

Drupal\ldap_servers\Helper

Code

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