ProcessResultInterface.php 897 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace Consolidation\AnnotatedCommand\Hooks;
  3. use Consolidation\AnnotatedCommand\CommandData;
  4. /**
  5. * A result processor takes a result object, processes it, and
  6. * returns another result object. For example, if a result object
  7. * represents a 'task', then a task-runner hook could run the
  8. * task and return the result from that execution.
  9. *
  10. * @see HookManager::addResultProcessor()
  11. */
  12. interface ProcessResultInterface
  13. {
  14. /**
  15. * After a command has executed, if the result is something
  16. * that needs to be processed, e.g. a collection of tasks to
  17. * run, then execute it and return the new result.
  18. *
  19. * @param mixed $result Result to (potentially) be processed
  20. * @param CommandData $commandData Reference to commandline arguments and options
  21. *
  22. * @return mixed $result
  23. */
  24. public function process($result, CommandData $commandData);
  25. }