upgraded dependencies

This commit is contained in:
RafficMohammed
2023-01-08 01:59:16 +05:30
parent 51056e3aad
commit f9ae387337
6895 changed files with 133617 additions and 178680 deletions

View File

@@ -20,6 +20,17 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class ProgressIndicator
{
private const FORMATS = [
'normal' => ' %indicator% %message%',
'normal_no_ansi' => ' %message%',
'verbose' => ' %indicator% %message% (%elapsed:6s%)',
'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
];
private $output;
private $startTime;
private $format;
@@ -30,13 +41,14 @@ class ProgressIndicator
private $indicatorUpdateTime;
private $started = false;
/**
* @var array<string, callable>
*/
private static $formatters;
private static $formats;
/**
* @param string|null $format Indicator format
* @param int $indicatorChangeInterval Change interval in milliseconds
* @param array|null $indicatorValues Animated indicator characters
* @param int $indicatorChangeInterval Change interval in milliseconds
* @param array|null $indicatorValues Animated indicator characters
*/
public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null)
{
@@ -64,10 +76,8 @@ class ProgressIndicator
/**
* Sets the current indicator message.
*
* @param string|null $message
*/
public function setMessage($message)
public function setMessage(?string $message)
{
$this->message = $message;
@@ -76,10 +86,8 @@ class ProgressIndicator
/**
* Starts the indicator output.
*
* @param $message
*/
public function start($message)
public function start(string $message)
{
if ($this->started) {
throw new LogicException('Progress indicator already started.');
@@ -124,7 +132,7 @@ class ProgressIndicator
*
* @param $message
*/
public function finish($message)
public function finish(string $message)
{
if (!$this->started) {
throw new LogicException('Progress indicator has not yet been started.');
@@ -139,28 +147,19 @@ class ProgressIndicator
/**
* Gets the format for a given name.
*
* @param string $name The format name
*
* @return string|null A format string
* @return string|null
*/
public static function getFormatDefinition($name)
public static function getFormatDefinition(string $name)
{
if (!self::$formats) {
self::$formats = self::initFormats();
}
return self::$formats[$name] ?? null;
return self::FORMATS[$name] ?? null;
}
/**
* Sets a placeholder formatter for a given name.
*
* This method also allow you to override an existing placeholder.
*
* @param string $name The placeholder name (including the delimiter char like %)
* @param callable $callable A PHP callable
*/
public static function setPlaceholderFormatterDefinition($name, $callable)
public static function setPlaceholderFormatterDefinition(string $name, callable $callable)
{
if (!self::$formatters) {
self::$formatters = self::initPlaceholderFormatters();
@@ -170,13 +169,11 @@ class ProgressIndicator
}
/**
* Gets the placeholder formatter for a given name.
* Gets the placeholder formatter for a given name (including the delimiter char like %).
*
* @param string $name The placeholder name (including the delimiter char like %)
*
* @return callable|null A PHP callable
* @return callable|null
*/
public static function getPlaceholderFormatterDefinition($name)
public static function getPlaceholderFormatterDefinition(string $name)
{
if (!self::$formatters) {
self::$formatters = self::initPlaceholderFormatters();
@@ -249,18 +246,4 @@ class ProgressIndicator
},
];
}
private static function initFormats(): array
{
return [
'normal' => ' %indicator% %message%',
'normal_no_ansi' => ' %message%',
'verbose' => ' %indicator% %message% (%elapsed:6s%)',
'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
];
}
}