package and depencies
This commit is contained in:
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace Illuminate\Console;
|
||||
|
||||
use Illuminate\Console\Contracts\NewLineAware;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class OutputStyle extends SymfonyStyle
|
||||
class OutputStyle extends SymfonyStyle implements NewLineAware
|
||||
{
|
||||
/**
|
||||
* The output instance.
|
||||
@@ -15,6 +16,13 @@ class OutputStyle extends SymfonyStyle
|
||||
*/
|
||||
private $output;
|
||||
|
||||
/**
|
||||
* If the last output written wrote a new line.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $newLineWritten = false;
|
||||
|
||||
/**
|
||||
* Create a new Console OutputStyle instance.
|
||||
*
|
||||
@@ -29,12 +37,54 @@ class OutputStyle extends SymfonyStyle
|
||||
parent::__construct($input, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function write(string|iterable $messages, bool $newline = false, int $options = 0)
|
||||
{
|
||||
$this->newLineWritten = $newline;
|
||||
|
||||
parent::write($messages, $newline, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL)
|
||||
{
|
||||
$this->newLineWritten = true;
|
||||
|
||||
parent::writeln($messages, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function newLine(int $count = 1)
|
||||
{
|
||||
$this->newLineWritten = $count > 0;
|
||||
|
||||
parent::newLine($count);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function newLineWritten()
|
||||
{
|
||||
if ($this->output instanceof static && $this->output->newLineWritten()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->newLineWritten;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether verbosity is quiet (-q).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isQuiet()
|
||||
public function isQuiet(): bool
|
||||
{
|
||||
return $this->output->isQuiet();
|
||||
}
|
||||
@@ -44,7 +94,7 @@ class OutputStyle extends SymfonyStyle
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isVerbose()
|
||||
public function isVerbose(): bool
|
||||
{
|
||||
return $this->output->isVerbose();
|
||||
}
|
||||
@@ -54,7 +104,7 @@ class OutputStyle extends SymfonyStyle
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isVeryVerbose()
|
||||
public function isVeryVerbose(): bool
|
||||
{
|
||||
return $this->output->isVeryVerbose();
|
||||
}
|
||||
@@ -64,7 +114,7 @@ class OutputStyle extends SymfonyStyle
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDebug()
|
||||
public function isDebug(): bool
|
||||
{
|
||||
return $this->output->isDebug();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user