function RemoteFilesystem::callbackGet
Get notification action.
Parameters
int $notificationCode The notification code:
int $severity The severity level:
string $message The message:
int $messageCode The message code:
int $bytesTransferred The loaded size:
int $bytesMax The total size:
Return value
void
Throws
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ RemoteFilesystem.php, line 564
Class
- RemoteFilesystem
- @internal @author François Pluchino <francois.pluchino@opendisplay.com> @author Jordi Boggiano <j.boggiano@seld.be> @author Nils Adermann <naderman@naderman.de>
Namespace
Composer\UtilCode
protected function callbackGet(int $notificationCode, int $severity, ?string $message, int $messageCode, int $bytesTransferred, int $bytesMax) {
switch ($notificationCode) {
case STREAM_NOTIFY_FAILURE:
if (400 === $messageCode) {
// This might happen if your host is secured by ssl client certificate authentication
// but you do not send an appropriate certificate
throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
}
break;
case STREAM_NOTIFY_FILE_SIZE_IS:
$this->bytesMax = $bytesMax;
break;
case STREAM_NOTIFY_PROGRESS:
if ($this->bytesMax > 0 && $this->progress) {
$progression = min(100, (int) round($bytesTransferred / $this->bytesMax * 100));
if (0 === $progression % 5 && 100 !== $progression && $progression !== $this->lastProgress) {
$this->lastProgress = $progression;
$this->io
->overwriteError("Downloading (<comment>{$progression}%</comment>)", false);
}
}
break;
default:
break;
}
}