Skip to content

Commit ce8d34e

Browse files
committed
[Console] added a note in the CHANGELOG for the previous merge, fixed some CS
1 parent b95995f commit ce8d34e

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
2.3.0
5+
-----
6+
7+
* added a way to set the progress bar progress via the `setCurrent` method
8+
49
2.2.0
510
-----
611

Helper/ProgressHelper.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ class ProgressHelper extends Helper
9191
* @var array
9292
*/
9393
private $widths = array(
94-
'current' => 4,
95-
'max' => 4,
96-
'percent' => 3,
97-
'elapsed' => 6,
94+
'current' => 4,
95+
'max' => 4,
96+
'percent' => 3,
97+
'elapsed' => 6,
9898
);
9999

100100
/**
@@ -227,11 +227,12 @@ public function advance($step = 1, $redraw = false)
227227
throw new \LogicException('You must start the progress bar before calling advance().');
228228
}
229229

230-
if ($this->current === 0) {
230+
if (0 === $this->current) {
231231
$redraw = true;
232232
}
233+
233234
$this->current += $step;
234-
if ($redraw || $this->current % $this->redrawFreq === 0) {
235+
if ($redraw || 0 === $this->current % $this->redrawFreq) {
235236
$this->display();
236237
}
237238
}
@@ -256,12 +257,12 @@ public function setCurrent($current, $redraw = false)
256257
throw new \LogicException('You can\'t regress the progress bar');
257258
}
258259

259-
if ($this->current === 0) {
260+
if (0 === $this->current) {
260261
$redraw = true;
261262
}
262263

263264
$this->current = $current;
264-
if ($redraw || $this->current % $this->redrawFreq === 0) {
265+
if ($redraw || 0 === $this->current % $this->redrawFreq) {
265266
$this->display();
266267
}
267268
}
@@ -295,7 +296,7 @@ public function finish()
295296
throw new \LogicException('You must start the progress bar before calling finish().');
296297
}
297298

298-
if ($this->startTime !== null) {
299+
if (null !== $this->startTime) {
299300
if (!$this->max) {
300301
$this->barChar = $this->barCharOriginal;
301302
$this->display(true);
@@ -313,7 +314,7 @@ private function initialize()
313314
{
314315
$this->formatVars = array();
315316
foreach ($this->defaultFormatVars as $var) {
316-
if (strpos($this->format, "%{$var}%") !== false) {
317+
if (false !== strpos($this->format, "%{$var}%")) {
317318
$this->formatVars[$var] = true;
318319
}
319320
}
@@ -344,7 +345,7 @@ private function generate($finish = false)
344345

345346
if (isset($this->formatVars['bar'])) {
346347
$completeBars = 0;
347-
$emptyBars = 0;
348+
$emptyBars = 0;
348349
if ($this->max > 0) {
349350
$completeBars = floor($percent * $this->barWidth);
350351
} else {
@@ -421,7 +422,7 @@ private function overwrite(OutputInterface $output, $message)
421422
$length = $this->getLength($message);
422423

423424
// append whitespace to match the last line's length
424-
if (($this->lastMessagesLength !== null) && ($this->lastMessagesLength > $length)) {
425+
if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
425426
$message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
426427
}
427428

0 commit comments

Comments
 (0)