You are here

function MessagingTestCase::formatTable in Messaging 7

Same name and namespace in other branches
  1. 6.4 tests/messaging_test_case.inc \MessagingTestCase::formatTable()
2 calls to MessagingTestCase::formatTable()
MessagingTestCase::dumpLogs in tests/messaging_test_case.inc
MessagingTestCase::printObject in tests/messaging_test_case.inc

File

tests/messaging_test_case.inc, line 44

Class

MessagingTestCase

Code

function formatTable($object, $max_depth = NULL) {
  if (isset($max_depth) && !$max_depth) {

    // Reached max depth, print out in debug format
    return '<pre>' . print_r($object, TRUE) . '</pre>';
  }
  foreach ($object as $key => $value) {
    $rows[] = array(
      $key,
      is_array($value) || is_object($value) ? $this
        ->formatTable($value, isset($max_depth) ? $max_depth - 1 : NULL) : $value,
    );
  }
  if (!empty($rows)) {
    return theme_table(array(), $rows);
  }
  else {
    return 'No properties';
  }
}