class drush_outputformat_print_r

  1. 8.0.x commands/core/outputformat/print_r.inc drush_outputformat_print_r
  2. 6.x commands/core/outputformat/print_r.inc drush_outputformat_print_r
  3. 7.x commands/core/outputformat/print_r.inc drush_outputformat_print_r
  4. master commands/core/outputformat/print_r.inc drush_outputformat_print_r

Output formatter 'print-r'

Hierarchy

Expanded class hierarchy of drush_outputformat_print_r

Members

File

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

View source
class drush_outputformat_print_r extends drush_outputformat {
  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;
  }
}