You are here

protected function LdapAuthorizationConsumerConf::pipeListToArray in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_authorization/LdapAuthorizationConsumerConf.class.php \LdapAuthorizationConsumerConf::pipeListToArray()
  2. 7 ldap_authorization/LdapAuthorizationConsumerConf.class.php \LdapAuthorizationConsumerConf::pipeListToArray()
1 call to LdapAuthorizationConsumerConf::pipeListToArray()
LdapAuthorizationConsumerConfAdmin::populateFromDrupalForm in ldap_authorization/LdapAuthorizationConsumerConfAdmin.class.php

File

ldap_authorization/LdapAuthorizationConsumerConf.class.php, line 175
Class to encapsulate an ldap entry to authorization consumer ids mapping configuration.

Class

LdapAuthorizationConsumerConf
LDAP Authorization Consumer Configuration.

Code

protected function pipeListToArray($mapping_list_txt, $make_item0_lowercase = FALSE) {
  $result_array = [];
  $mappings = preg_split('/[\\n\\r]+/', $mapping_list_txt);
  foreach ($mappings as $line) {
    if (count($mapping = explode('|', trim($line))) == 2) {
      $item_0 = $make_item0_lowercase ? drupal_strtolower(trim($mapping[0])) : trim($mapping[0]);
      $result_array[] = [
        $item_0,
        trim($mapping[1]),
      ];
    }
  }
  return $result_array;
}