| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function write(OutputInterface $output, $data, FormatterOptions $options) |
||
| 22 | { |
||
| 23 | $dumper = new CliDumper(); |
||
| 24 | $cloned_data = (new VarCloner())->cloneVar($data); |
||
| 25 | |||
| 26 | if ($output instanceof StreamOutput) { |
||
| 27 | // When stream output is used the dumper is smart enough to |
||
| 28 | // determine whether or not to apply colors to the dump. |
||
| 29 | // @see Symfony\Component\VarDumper\Dumper\CliDumper::supportsColors |
||
| 30 | $dumper->dump($cloned_data, $output->getStream()); |
||
| 31 | } else { |
||
| 32 | // @todo Use dumper return value to get output once we stop support |
||
| 33 | // VarDumper v2. |
||
| 34 | $stream = fopen('php://memory', 'r+b'); |
||
| 35 | $dumper->dump($cloned_data, $stream); |
||
| 36 | $output->writeln(stream_get_contents($stream, -1, 0)); |
||
| 37 | fclose($stream); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | } |
||
| 41 |