function annotationcommand_adapter_get_commands

master annotationcommand_adapter.inc annotationcommand_adapter_get_commands($annotation_commandfiles)

Internal function called by annotationcommand_adapter_commands, which is called by drush_get_commands().

Parameters

array $annotation_commandfiles path => class mapping:

Return value

object[]

1 call to annotationcommand_adapter_get_commands()
annotationcommand_adapter_commands in includes/annotationcommand_adapter.inc
Return the cached commands built by annotationcommand_adapter_discover.

File

includes/annotationcommand_adapter.inc, line 241
annotationcommand_adapter.inc

Code

function annotationcommand_adapter_get_commands($annotation_commandfiles) {
  $commands =[];
  // This will give us a list containing something akin to:
  //   'modules/default_content/src/CliTools/DefaultContentCommands.php' =>
  //   '\\Drupal\\default_content\\CliTools\\DefaultContentCommands',
  foreach ($annotation_commandfiles as $commandfile_path => $commandfile_class) {
    if (file_exists($commandfile_path)) {
      $commandhandler = annotationcommand_adapter_create_commandfile_instance($commandfile_path, $commandfile_class);
      $commands_for_this_commandhandler = annotationcommand_adapter_get_commands_for_commandhandler($commandhandler, $commandfile_path);
      $commands = array_merge($commands, $commands_for_this_commandhandler);
    }
  }
  return $commands;
}