function annotationcommand_adapter_call_process_interface

master annotationcommand_adapter.inc annotationcommand_adapter_call_process_interface($names, $hooks, CommandData $commandData, $return)

Given a list of hooks that conform to the interface ProcessResultInterface, call them and return the result.

Parameters

string[] $names All of the applicable names for the command being hooked:

string[] $hooks All of the HookManager hooks that should be called:

CommandData $commandData All of the parameter data associated with the: current command invokation, including the InputInterface, OutputInterface and AnnotationData

mixed $return The return value of the command being executed:

Return value

mixed The altered command return value

2 calls to annotationcommand_adapter_call_process_interface()
annotationcommand_adapter_call_hook_post_command in includes/annotationcommand_adapter.inc
Convert from an old-style Drush post-command hook into annotated-command hooks.
annotationcommand_adapter_call_hook_process_and_alter in includes/annotationcommand_adapter.inc
After the primary Drush command hook is called, call all of the annotated-command process and alter hooks.

File

includes/annotationcommand_adapter.inc, line 699
annotationcommand_adapter.inc

Code

function annotationcommand_adapter_call_process_interface($names, $hooks, CommandData $commandData, $return) {
  $factory = \Drush::commandFactory();
  $hookManager = $factory->hookManager();

  $hooks = $hookManager->getHooks($names, $hooks, $commandData->annotationData());

  foreach ((array) $hooks as $hook) {
    // @todo: $hook might be a ProcessResultInterface object. Support those?
    if (is_object($hook)) {
      continue;
    }
    $result = $hook($return, $commandData);
    if (isset($result)) {
      $return = $result;
    }
  }
  return $return;
}