Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / consolidation / robo / src / Task / Composer / DumpAutoload.php
diff --git a/vendor/consolidation/robo/src/Task/Composer/DumpAutoload.php b/vendor/consolidation/robo/src/Task/Composer/DumpAutoload.php
new file mode 100644 (file)
index 0000000..55b1ea0
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+namespace Robo\Task\Composer;
+
+/**
+ * Composer Dump Autoload
+ *
+ * ``` php
+ * <?php
+ * // simple execution
+ * $this->taskComposerDumpAutoload()->run();
+ *
+ * // dump auto loader with custom path
+ * $this->taskComposerDumpAutoload('path/to/my/composer.phar')
+ *      ->preferDist()
+ *      ->run();
+ *
+ * // optimize autoloader dump with custom path
+ * $this->taskComposerDumpAutoload('path/to/my/composer.phar')
+ *      ->optimize()
+ *      ->run();
+ *
+ * // optimize autoloader dump with custom path and no dev
+ * $this->taskComposerDumpAutoload('path/to/my/composer.phar')
+ *      ->optimize()
+ *      ->noDev()
+ *      ->run();
+ * ?>
+ * ```
+ */
+class DumpAutoload extends Base
+{
+    /**
+     * {@inheritdoc}
+     */
+    protected $action = 'dump-autoload';
+
+    /**
+     * @var string
+     */
+    protected $optimize;
+
+    /**
+     * @return $this
+     */
+    public function optimize($optimize = true)
+    {
+        if ($optimize) {
+            $this->option("--optimize");
+        }
+        return $this;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function run()
+    {
+        $command = $this->getCommand();
+        $this->printTaskInfo('Dumping Autoloader: {command}', ['command' => $command]);
+        return $this->executeCommand($command);
+    }
+}