function drush_outputformat_print_r::format

8.0.x print_r.inc drush_outputformat_print_r::format($input, $metadata)
6.x print_r.inc drush_outputformat_print_r::format($input, $metadata)
7.x print_r.inc drush_outputformat_print_r::format($input, $metadata)
master print_r.inc drush_outputformat_print_r::format($input, $metadata)

Overrides drush_outputformat::format

File

commands/core/outputformat/print_r.inc, line 36

Class

drush_outputformat_print_r
Output formatter 'print-r'

Code

function format($input, $metadata) {
  if (is_string($input)) {
    $output = '"' . $input . '"';
  }
  elseif (is_array($input) || is_object($input)) {
    $output = print_r($input, TRUE);
  }
  else {
    $output = $input;
  }
  if (isset($metadata['label'])) {
    $output = $metadata['label'] . ': ' . $output;
  }
  return $output;
}