Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / consolidation / robo / src / Common / OutputAwareTrait.php
diff --git a/vendor/consolidation/robo/src/Common/OutputAwareTrait.php b/vendor/consolidation/robo/src/Common/OutputAwareTrait.php
new file mode 100644 (file)
index 0000000..48082cb
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+
+namespace Robo\Common;
+
+use Symfony\Component\Console\Output\NullOutput;
+use Symfony\Component\Console\Output\OutputInterface;
+
+trait OutputAwareTrait
+{
+    /**
+     * @var \Symfony\Component\Console\Output\OutputInterface
+     */
+    protected $output;
+
+    /**
+     * @param \Symfony\Component\Console\Output\OutputInterface $output
+     *
+     * @return $this
+     *
+     * @see \Robo\Contract\OutputAwareInterface::setOutput()
+     */
+    public function setOutput(OutputInterface $output)
+    {
+        $this->output = $output;
+
+        return $this;
+    }
+
+    /**
+     * @return \Symfony\Component\Console\Output\OutputInterface
+     */
+    protected function output()
+    {
+        if (!isset($this->output)) {
+            $this->setOutput(new NullOutput());
+        }
+        return $this->output;
+    }
+
+    /**
+     * Backwards compatibility
+     *
+     * @return \Symfony\Component\Console\Output\OutputInterface
+     *
+     * @deprecated
+     */
+    protected function getOutput()
+    {
+        return $this->output();
+    }
+}