Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / consolidation / robo / src / Common / OutputAwareTrait.php
1 <?php
2
3 namespace Robo\Common;
4
5 use Symfony\Component\Console\Output\NullOutput;
6 use Symfony\Component\Console\Output\OutputInterface;
7
8 trait OutputAwareTrait
9 {
10     /**
11      * @var \Symfony\Component\Console\Output\OutputInterface
12      */
13     protected $output;
14
15     /**
16      * @param \Symfony\Component\Console\Output\OutputInterface $output
17      *
18      * @return $this
19      *
20      * @see \Robo\Contract\OutputAwareInterface::setOutput()
21      */
22     public function setOutput(OutputInterface $output)
23     {
24         $this->output = $output;
25
26         return $this;
27     }
28
29     /**
30      * @return \Symfony\Component\Console\Output\OutputInterface
31      */
32     protected function output()
33     {
34         if (!isset($this->output)) {
35             $this->setOutput(new NullOutput());
36         }
37         return $this->output;
38     }
39
40     /**
41      * Backwards compatibility
42      *
43      * @return \Symfony\Component\Console\Output\OutputInterface
44      *
45      * @deprecated
46      */
47     protected function getOutput()
48     {
49         return $this->output();
50     }
51 }