Version 1
[yaffs-website] / vendor / consolidation / annotated-command / src / CommandCreationListener.php
diff --git a/vendor/consolidation/annotated-command/src/CommandCreationListener.php b/vendor/consolidation/annotated-command/src/CommandCreationListener.php
new file mode 100644 (file)
index 0000000..cf1e783
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+namespace Consolidation\AnnotatedCommand;
+
+/**
+ * Command cration listeners can be added to the annotation
+ * command factory.  These will be notified whenever a new
+ * commandfile is provided to the factory.  This is useful for
+ * initializing new commandfile objects.
+ *
+ * @see AnnotatedCommandFactory::addListener()
+ */
+class CommandCreationListener implements CommandCreationListenerInterface
+{
+    protected $listener;
+
+    public function __construct($listener)
+    {
+        $this->listener = $listener;
+    }
+
+    public function notifyCommandFileAdded($command)
+    {
+        call_user_func($this->listener, $command);
+    }
+}