Generator/API.php
function hook_code($hook_short_name, $parameters_string) {
    $parameters = explode(', ', $parameters_string);
    $parameters_doc_lines = array();
    foreach ($parameters as $parameter) {
      $parameters_doc_lines[] = " * @param $parameter\n" .
                                " *   TODO: document this parameter.";
    }
    if (!empty($parameters_doc_lines)) {
      $parameters_doc = " *\n" . implode("\n", $parameters_doc_lines);
    }

    return <<<EOT
/**
 * TODO: write summary line.
 *
 * TODO: longer description.
$parameters_doc
 *
 * @return
 *   TODO: Document return value if there is one.
 */
function hook_$hook_short_name($parameters_string) {
  // TODO: write sample code.
}

EOT;
  }
function hook_code($hook_short_name, $parameters_string) {
    $parameters = explode(', ', $parameters_string);
    $parameters_doc_lines = array();
    foreach ($parameters as $parameter) {
      $parameters_doc_lines[] = " * @param $parameter\n" .
                                " *   TODO: document this parameter.";
    }
    if (!empty($parameters_doc_lines)) {
      $parameters_doc = " *\n" . implode("\n", $parameters_doc_lines);
    }

    return <<<EOT
/**
 * TODO: write summary line.
 *
 * TODO: longer description.
$parameters_doc
 *
 * @return
 *   TODO: Document return value if there is one.
 */
function hook_$hook_short_name($parameters_string) {
  // TODO: write sample code.
}

EOT;
  }
function hook_code ( $ hook_short_name , $ parameters_string ) { $ parameters = explode ( ', ' , $ parameters_string ) ; $ parameters_doc_lines = array ( ) ; foreach ( $ parameters as $ parameter ) { $ parameters_doc_lines [ ] = " * @param $parameter\n" . " *   TODO: document this parameter." ; } if ( ! empty ( $ parameters_doc_lines ) ) { $ parameters_doc = " *\n" . implode ( "\n" , $ parameters_doc_lines ) ; } return  <<<EOT
/**
 * TODO: write summary line.
 *
 * TODO: longer description.
$parameters_doc
 *
 * @return
 *   TODO: Document return value if there is one.
 */
function hook_$hook_short_name($parameters_string) {
  // TODO: write sample code.
}

EOT ; }
Create the code for a single hook.

@param $hook_short_name
The short name of the hook, i.e., without the 'hook_' prefix.
@param $parameters_string
A string of the hook's parameters.

@return
A string of formatted code for inclusion in the api.php file.
Create the code for a single hook .