You are here

protected function AuthController::auth0PipeListToArray in Auth0 Single Sign On 8.2

Convert pipe list to array.

Parameters

string $mappingListTxt: The pipe list string.

Return value

array An array of items.

2 calls to AuthController::auth0PipeListToArray()
AuthController::auth0UpdateFields in src/Controller/AuthController.php
Update the $user profile attributes based on the auth0 field mappings.
AuthController::auth0UpdateRoles in src/Controller/AuthController.php
Updates the $user->roles of a user based on the Auth0 role mappings.

File

src/Controller/AuthController.php, line 907
Contains \Drupal\auth0\Controller\AuthController.

Class

AuthController
Controller routines for auth0 authentication.

Namespace

Drupal\auth0\Controller

Code

protected function auth0PipeListToArray($mappingListTxt) {
  $return = [];
  $mappings = explode(PHP_EOL, $mappingListTxt);
  foreach ($mappings as $line) {
    if (empty($line) || FALSE === strpos($line, '|')) {
      continue;
    }
    $line_parts = explode('|', $line);
    $return[] = [
      trim($line_parts[0]),
      trim($line_parts[1]),
    ];
  }
  return $return;
}