| Total Complexity | 5 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | abstract class AbstractOutputtingSubscriber |
||
| 11 | { |
||
| 12 | private ?OutputInterface $output; |
||
| 13 | |||
| 14 | public function onErrorEvent(Event\ErrorEvent $event): void |
||
| 15 | { |
||
| 16 | $this->getOutput()->writeln("<error>{$event->getMessage()}</error>"); |
||
| 17 | |||
| 18 | if ($this->getOutput()->isVerbose()) { |
||
| 19 | $this->getOutput()->writeln("<error>{$event->getException()}</error>"); |
||
| 20 | } |
||
| 21 | } |
||
| 22 | |||
| 23 | public function getOutput(): OutputInterface |
||
| 24 | { |
||
| 25 | if (!isset($this->output)) { |
||
| 26 | throw new \LogicException('Unable to get output, did you call setOutput()?'); |
||
| 27 | } |
||
| 28 | |||
| 29 | return $this->output; |
||
|
|
|||
| 30 | } |
||
| 31 | |||
| 32 | public function setOutput(OutputInterface $output): void |
||
| 35 | } |
||
| 36 | } |
||
| 37 |