You are here

function _drush_devel_print_function in Devel 6

Same name and namespace in other branches
  1. 8.3 drush/devel.drush8.inc \_drush_devel_print_function()
  2. 8 drush/devel.drush8.inc \_drush_devel_print_function()
  3. 8.2 drush/devel.drush8.inc \_drush_devel_print_function()
  4. 7 devel.drush.inc \_drush_devel_print_function()

Print the specified function, including any doxygen-style comments that come before it.

1 call to _drush_devel_print_function()
drush_devel_fn_view in ./devel.drush.inc
Command handler. Show source code of specified function or method.

File

./devel.drush.inc, line 170
Drush integration for the devel module.

Code

function _drush_devel_print_function($file, $start_line, $end_line) {
  $line_num = 0;
  $doxygen = NULL;
  $fp = fopen($file, 'r');
  while (!feof($fp) && $line_num < $start_line - 1) {
    $line = fgets($fp);
    ++$line_num;
    if (substr($line, 0, 3) == '/**') {
      $doxygen = $line;
    }
    elseif (isset($doxygen)) {
      $doxygen .= $line;
      if ($line_num + 1 == $start_line) {
        drush_print(rtrim($doxygen));
      }
      if (strstr($line, '*/') !== FALSE) {
        $doxygen = NULL;
      }
    }
  }
  while (!feof($fp) && $line_num < $end_line) {
    $line = fgets($fp);
    ++$line_num;
    drush_print(rtrim($line));
  }
}