You are here

function module_builder_requested_filenames in Module Builder 7

Same name and namespace in other branches
  1. 6.2 drush/module_builder.drush.inc \module_builder_requested_filenames()

Figure out which of $real filenames are being requested in the list of $abbrev'iated ones.

Return value

A flat array of filenames from $real. Those whose abreviations were not found. in $abbrev are removed.

1 call to module_builder_requested_filenames()
module_builder_callback_module in drush/module_builder.drush.inc
Handles the callback for module code generation.

File

drush/module_builder.drush.inc, line 311
Module builder drush commands.

Code

function module_builder_requested_filenames($module_root_name, $real, $abbrev) {

  //print_r($real);
  foreach ($real as $r) {
    $p = preg_replace(array(
      "[^{$module_root_name}\\.]",
      // module_name. at start
      '[\\.inc$]',
    ), array(
      '',
      '',
    ), $r);
    $processed[$r] = $p;

    // build an array with the real names as keys
    // and the abbrevs as values
  }

  //print_r($processed);

  //print_r($abbrev);

  // Intersecting thorws away values that are not in $abbrev
  // while keeping the real filename keys.
  $result = array_intersect($processed, $abbrev);

  //print_r($result);

  // We only care about the keys anyway
  return array_keys($result);
}