Version 1
[yaffs-website] / vendor / drupal / console / src / Bootstrap / FindGeneratorsCompilerPass.php
diff --git a/vendor/drupal/console/src/Bootstrap/FindGeneratorsCompilerPass.php b/vendor/drupal/console/src/Bootstrap/FindGeneratorsCompilerPass.php
new file mode 100644 (file)
index 0000000..601a9d9
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+
+namespace Drupal\Console\Bootstrap;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * FindGeneratorsCompilerPass
+ */
+class FindGeneratorsCompilerPass implements CompilerPassInterface
+{
+    /**
+     * @var string
+     */
+    protected $serviceTag;
+
+    /**
+     * FindCommandsCompilerPass constructor.
+     *
+     * @param $serviceTag
+     */
+    public function __construct($serviceTag)
+    {
+        $this->serviceTag = $serviceTag;
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function process(ContainerBuilder $container)
+    {
+        $taggedServices = $container->findTaggedServiceIds(
+            $this->serviceTag
+        );
+
+        $generators = [];
+        foreach ($taggedServices as $id => $tags) {
+            $generators[] = $id;
+        }
+
+        $container->setParameter('drupal.generators', $generators);
+    }
+}