X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fconsolidation%2Fannotated-command%2Fsrc%2FHooks%2FHookManager.php;fp=vendor%2Fconsolidation%2Fannotated-command%2Fsrc%2FHooks%2FHookManager.php;h=ade39aaed93702899a3220e3fd7690bed301b9c7;hp=89cd319379744c9c59ce35443dd902df18e31a14;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/consolidation/annotated-command/src/Hooks/HookManager.php b/vendor/consolidation/annotated-command/src/Hooks/HookManager.php index 89cd31937..ade39aaed 100644 --- a/vendor/consolidation/annotated-command/src/Hooks/HookManager.php +++ b/vendor/consolidation/annotated-command/src/Hooks/HookManager.php @@ -8,6 +8,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\ConsoleEvents; use Symfony\Component\Console\Event\ConsoleCommandEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\EventDispatcher\EventDispatcher; use Consolidation\AnnotatedCommand\ExitCodeInterface; use Consolidation\AnnotatedCommand\OutputDataInterface; @@ -132,6 +134,32 @@ class HookManager implements EventSubscriberInterface return $this; } + public function addPreCommandEventDispatcher(EventDispatcherInterface $eventDispatcher, $name = '*') + { + $this->hooks[$name][self::PRE_COMMAND_EVENT][] = $eventDispatcher; + return $this; + } + + public function addCommandEventDispatcher(EventDispatcherInterface $eventDispatcher, $name = '*') + { + $this->hooks[$name][self::COMMAND_EVENT][] = $eventDispatcher; + return $this; + } + + public function addPostCommandEventDispatcher(EventDispatcherInterface $eventDispatcher, $name = '*') + { + $this->hooks[$name][self::POST_COMMAND_EVENT][] = $eventDispatcher; + return $this; + } + + public function addCommandEvent(EventSubscriberInterface $eventSubscriber) + { + // Wrap the event subscriber in a dispatcher and add it + $dispatcher = new EventDispatcher(); + $dispatcher->addSubscriber($eventSubscriber); + return $this->addCommandEventDispatcher($dispatcher); + } + /** * Add an configuration provider hook *