function miniorange_oauth_clientController::getnestedattribute in OAuth2 Login 8
This function is used to get some specific values from the resource
1 call to miniorange_oauth_clientController::getnestedattribute()
File
- src/
Controller/ miniorange_oauth_clientController.php, line 333 - Contains \Drupal\miniorange_oauth_client\Controller\DefaultController.
Class
Namespace
Drupal\oauth2_login\ControllerCode
function getnestedattribute($resource, $key) {
if (empty($key)) {
return "";
}
$keys = explode(".", $key);
$currentkey = "";
if (sizeof($keys) > 1) {
$currentkey = $keys[0];
if (isset($resource[$currentkey])) {
return self::getnestedattribute($resource[$currentkey], str_replace($currentkey . ".", "", $key));
}
}
else {
$currentkey = $keys[0];
if (isset($resource[$currentkey])) {
if (is_array($resource[$currentkey])) {
$resource = $resource[$currentkey];
return $resource[0];
}
else {
return $resource[$currentkey];
}
}
}
}