1
0
Fork 0

Fix bug display in FileDownloader

pull/219/head
François Pluchino 2012-01-18 12:51:37 +01:00
parent 9987b2aa83
commit 3cbe7cf590
3 changed files with 5 additions and 5 deletions

View File

@ -103,7 +103,7 @@ abstract class FileDownloader implements DownloaderInterface
$ctx = stream_context_create($params); $ctx = stream_context_create($params);
stream_context_set_params($ctx, array("notification" => array($this, 'callbackGet'))); stream_context_set_params($ctx, array("notification" => array($this, 'callbackGet')));
$this->io->overwrite(" Downloading: <comment>connection...</comment>"); $this->io->overwrite(" Downloading: <comment>connection...</comment>", false);
copy($url, $fileName, $ctx); copy($url, $fileName, $ctx);
$this->io->overwrite(" Downloading"); $this->io->overwrite(" Downloading");
@ -193,7 +193,7 @@ abstract class FileDownloader implements DownloaderInterface
} }
if (0 === $progression % 5) { if (0 === $progression % 5) {
$this->io->overwrite(" Downloading: <comment>$progression%</comment>"); $this->io->overwrite(" Downloading: <comment>$progression%</comment>", false);
} }
} }
break; break;

View File

@ -65,7 +65,7 @@ class ConsoleIO implements IOInterface
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function overwrite($messages, $size = 80, $newline = false) public function overwrite($messages, $newline = true, $size = 80)
{ {
for ($place = $size; $place > 0; $place--) { for ($place = $size; $place > 0; $place--) {
$this->write("\x08", false); $this->write("\x08", false);

View File

@ -38,10 +38,10 @@ interface IOInterface
* Overwrites a previous message to the output. * Overwrites a previous message to the output.
* *
* @param string|array $messages The message as an array of lines or a single string * @param string|array $messages The message as an array of lines or a single string
* @param integer $size The size of line
* @param Boolean $newline Whether to add a newline or not * @param Boolean $newline Whether to add a newline or not
* @param integer $size The size of line
*/ */
function overwrite($messages, $size = 80, $newline = true); function overwrite($messages, $newline = true, $size = 80);
/** /**
* Asks a question to the user. * Asks a question to the user.