You are here

function oauth2_loginController::getnestedattribute in OAuth2 Login 8

This function is used to get some specific values from the resource

1 call to oauth2_loginController::getnestedattribute()
oauth2_loginController::oauth2_login_mo_login in src/Controller/oauth2_loginController.php

File

src/Controller/oauth2_loginController.php, line 246
Contains \Drupal\oauth2_login\Controller\DefaultController.

Class

oauth2_loginController

Namespace

Drupal\oauth2_login\Controller

Code

function getnestedattribute($resource, $key) {
  if (empty($key)) {
    return "";
  }
  $keys = explode(".", $key);
  if (sizeof($keys) > 1) {
    $current_key = $keys[0];
    if (isset($resource[$current_key])) {
      return self::getnestedattribute($resource[$current_key], str_replace($current_key . ".", "", $key));
    }
  }
  else {
    $current_key = $keys[0];
    if (isset($resource[$current_key])) {
      return $resource[$current_key];
    }
  }
}