You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
2.9 KiB
PHP
121 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace jrosset\CliProgram\Output;
|
|
|
|
use jrosset\CliProgram\CliHelper;
|
|
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
/**
|
|
* A wrapper for an OutputInterface
|
|
*/
|
|
abstract class OutputWrapper implements OutputInterface {
|
|
/**
|
|
* @var OutputInterface The real output interface
|
|
*/
|
|
private OutputInterface $output;
|
|
|
|
/**
|
|
* Initialization
|
|
*
|
|
* @param OutputInterface $output The real output interface
|
|
*/
|
|
public function __construct (OutputInterface $output) {
|
|
$this->output = $output;
|
|
}
|
|
|
|
/**
|
|
* The real output interface
|
|
*
|
|
* @return OutputInterface The real output interface
|
|
*/
|
|
public function getOutput (): OutputInterface {
|
|
return $this->output;
|
|
}
|
|
/**
|
|
* The “error” output
|
|
*
|
|
* @return static The “error” output
|
|
*/
|
|
public function getErrorOutput (): static {
|
|
return new static(CliHelper::getErrorOutput($this));
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function write (iterable|string $messages, bool $newline = false, int $options = 0) {
|
|
return $this->getOutput()->write($messages, $newline, $options);
|
|
}
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function writeln (iterable|string $messages, int $options = 0) {
|
|
return $this->getOutput()->writeln($messages, $options);
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function setVerbosity (int $level) {
|
|
return $this->getOutput()->setVerbosity($level);
|
|
}
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getVerbosity (): int {
|
|
return $this->getOutput()->getVerbosity();
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function isQuiet (): bool {
|
|
return $this->getOutput()->isQuiet();
|
|
}
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function isVerbose (): bool {
|
|
return $this->getOutput()->isVerbose();
|
|
}
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function isVeryVerbose (): bool {
|
|
return $this->getOutput()->isVeryVerbose();
|
|
}
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function isDebug (): bool {
|
|
return $this->getOutput()->isDebug();
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function setDecorated (bool $decorated) {
|
|
return $this->getOutput()->setDecorated($decorated);
|
|
}
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function isDecorated (): bool {
|
|
return $this->getOutput()->isDecorated();
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
* @noinspection PhpInappropriateInheritDocUsageInspection
|
|
*/
|
|
public function setFormatter (OutputFormatterInterface $formatter) {
|
|
return $this->getOutput()->setFormatter($formatter);
|
|
}
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getFormatter (): OutputFormatterInterface {
|
|
return $this->getOutput()->getFormatter();
|
|
}
|
|
} |