composer update, composer corelibs update, admin pages update

This commit is contained in:
Clemens Schwaighofer
2023-05-31 16:17:14 +09:00
parent 513b115d57
commit 3d6b461b20
211 changed files with 10013 additions and 1461 deletions

View File

@@ -26,7 +26,7 @@ enum AnsiColorMode
case Ansi4;
/*
* 8-bit Ansi colors (240 differents colors + 16 duplicate color codes, ensuring backward compatibility).
* 8-bit Ansi colors (240 different colors + 16 duplicate color codes, ensuring backward compatibility).
* Output syntax is: "ESC[38;5;${foreGroundColorcode};48;5;${backGroundColorcode}m"
* Should be compatible with most terminals.
*/
@@ -78,25 +78,7 @@ enum AnsiColorMode
private function degradeHexColorToAnsi4(int $r, int $g, int $b): int
{
if (0 === round($this->getSaturation($r, $g, $b) / 50)) {
return 0;
}
return (int) ((round($b / 255) << 2) | (round($g / 255) << 1) | round($r / 255));
}
private function getSaturation(int $r, int $g, int $b): int
{
$r = $r / 255;
$g = $g / 255;
$b = $b / 255;
$v = max($r, $g, $b);
if (0 === $diff = $v - min($r, $g, $b)) {
return 0;
}
return (int) ((int) $diff * 100 / $v);
return round($b / 255) << 2 | (round($g / 255) << 1) | round($r / 255);
}
/**

View File

@@ -29,6 +29,9 @@ class BufferedOutput extends Output
return $content;
}
/**
* @return void
*/
protected function doWrite(string $message, bool $newline)
{
$this->buffer .= $message;

View File

@@ -64,18 +64,27 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
}
/**
* @return void
*/
public function setDecorated(bool $decorated)
{
parent::setDecorated($decorated);
$this->stderr->setDecorated($decorated);
}
/**
* @return void
*/
public function setFormatter(OutputFormatterInterface $formatter)
{
parent::setFormatter($formatter);
$this->stderr->setFormatter($formatter);
}
/**
* @return void
*/
public function setVerbosity(int $level)
{
parent::setVerbosity($level);
@@ -87,6 +96,9 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
return $this->stderr;
}
/**
* @return void
*/
public function setErrorOutput(OutputInterface $error)
{
$this->stderr = $error;

View File

@@ -24,6 +24,9 @@ interface ConsoleOutputInterface extends OutputInterface
*/
public function getErrorOutput(): OutputInterface;
/**
* @return void
*/
public function setErrorOutput(OutputInterface $error);
public function section(): ConsoleSectionOutput;

View File

@@ -60,6 +60,8 @@ class ConsoleSectionOutput extends StreamOutput
* Clears previous output for this section.
*
* @param int $lines Number of lines to clear. If null, then the entire output of this section is cleared
*
* @return void
*/
public function clear(int $lines = null)
{
@@ -81,6 +83,8 @@ class ConsoleSectionOutput extends StreamOutput
/**
* Overwrites the previous output with a new message.
*
* @return void
*/
public function overwrite(string|iterable $message)
{
@@ -153,12 +157,15 @@ class ConsoleSectionOutput extends StreamOutput
/**
* @internal
*/
public function addNewLineOfInputSubmit()
public function addNewLineOfInputSubmit(): void
{
$this->content[] = \PHP_EOL;
++$this->lines;
}
/**
* @return void
*/
protected function doWrite(string $message, bool $newline)
{
if (!$this->isDecorated()) {

View File

@@ -26,6 +26,9 @@ class NullOutput implements OutputInterface
{
private NullOutputFormatter $formatter;
/**
* @return void
*/
public function setFormatter(OutputFormatterInterface $formatter)
{
// do nothing
@@ -37,6 +40,9 @@ class NullOutput implements OutputInterface
return $this->formatter ??= new NullOutputFormatter();
}
/**
* @return void
*/
public function setDecorated(bool $decorated)
{
// do nothing
@@ -47,6 +53,9 @@ class NullOutput implements OutputInterface
return false;
}
/**
* @return void
*/
public function setVerbosity(int $level)
{
// do nothing
@@ -77,11 +86,17 @@ class NullOutput implements OutputInterface
return false;
}
/**
* @return void
*/
public function writeln(string|iterable $messages, int $options = self::OUTPUT_NORMAL)
{
// do nothing
}
/**
* @return void
*/
public function write(string|iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
{
// do nothing

View File

@@ -44,6 +44,9 @@ abstract class Output implements OutputInterface
$this->formatter->setDecorated($decorated);
}
/**
* @return void
*/
public function setFormatter(OutputFormatterInterface $formatter)
{
$this->formatter = $formatter;
@@ -54,6 +57,9 @@ abstract class Output implements OutputInterface
return $this->formatter;
}
/**
* @return void
*/
public function setDecorated(bool $decorated)
{
$this->formatter->setDecorated($decorated);
@@ -64,6 +70,9 @@ abstract class Output implements OutputInterface
return $this->formatter->isDecorated();
}
/**
* @return void
*/
public function setVerbosity(int $level)
{
$this->verbosity = $level;
@@ -94,11 +103,17 @@ abstract class Output implements OutputInterface
return self::VERBOSITY_DEBUG <= $this->verbosity;
}
/**
* @return void
*/
public function writeln(string|iterable $messages, int $options = self::OUTPUT_NORMAL)
{
$this->write($messages, true, $options);
}
/**
* @return void
*/
public function write(string|iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
{
if (!is_iterable($messages)) {
@@ -133,6 +148,8 @@ abstract class Output implements OutputInterface
/**
* Writes a message to the output.
*
* @return void
*/
abstract protected function doWrite(string $message, bool $newline);
}

View File

@@ -36,6 +36,8 @@ interface OutputInterface
* @param bool $newline Whether to add a newline
* @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants),
* 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
*
* @return void
*/
public function write(string|iterable $messages, bool $newline = false, int $options = 0);
@@ -44,11 +46,15 @@ interface OutputInterface
*
* @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants),
* 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
*
* @return void
*/
public function writeln(string|iterable $messages, int $options = 0);
/**
* Sets the verbosity of the output.
*
* @return void
*/
public function setVerbosity(int $level);
@@ -79,6 +85,8 @@ interface OutputInterface
/**
* Sets the decorated flag.
*
* @return void
*/
public function setDecorated(bool $decorated);
@@ -87,6 +95,9 @@ interface OutputInterface
*/
public function isDecorated(): bool;
/**
* @return void
*/
public function setFormatter(OutputFormatterInterface $formatter);
/**

View File

@@ -62,6 +62,9 @@ class StreamOutput extends Output
return $this->stream;
}
/**
* @return void
*/
protected function doWrite(string $message, bool $newline)
{
if ($newline) {

View File

@@ -45,6 +45,9 @@ class TrimmedBufferOutput extends Output
return $content;
}
/**
* @return void
*/
protected function doWrite(string $message, bool $newline)
{
$this->buffer .= $message;