You are here

public static function Utilities::show_attr in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login 8

2 calls to Utilities::show_attr()
miniorange_oauth_clientController::miniorange_oauth_client_mo_login in src/Controller/miniorange_oauth_clientController.php
Utilities::show_attr_list_from_idp in src/Utilities.php

File

src/Utilities.php, line 486

Class

Utilities

Namespace

Drupal\miniorange_oauth_client

Code

public static function show_attr($attrs, &$result, $depth = 0, $carry = '', $tr = '<tr>', $td = '<td>') {
  if (!is_array($attrs) || sizeof($attrs) < 1) {
    return is_array($attrs) ? '' : $attrs . '</td></tr>';
  }
  foreach ($attrs as $key => $value) {
    if (is_array($value)) {
      if ($depth == 0) {
        $carry = $tr . $td . $key;
        self::show_attr($attrs[$key], $result, $depth + 1, $carry, $tr, $td);
      }
      else {
        self::show_attr($attrs[$key], $result, $depth + 1, $carry . '.' . $key, $tr, $td);
      }
    }
    else {
      if ($depth == 0) {
        $result .= $tr . $td . $key . '</td>' . $td . $value . '</td></tr>';
      }
      else {
        if (!empty($carry)) {
          $result .= $carry . '.' . $key . '</td>' . $td . $value . '</td></tr>';
        }
      }
    }
  }
}