Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ZipDownloader.php

function ZipDownloader::getErrorMessage

Give a meaningful error message to the user.

1 call to ZipDownloader::getErrorMessage()
ZipDownloader::extractWithZipArchive in vendor/composer/composer/src/Composer/Downloader/ZipDownloader.php
extract $file to $path with ZipArchive

File

vendor/composer/composer/src/Composer/Downloader/ZipDownloader.php, line 275

Class

ZipDownloader
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Downloader

Code

protected function getErrorMessage(int $retval, string $file) : string {
    switch ($retval) {
        case ZipArchive::ER_EXISTS:
            return sprintf("File '%s' already exists.", $file);
        case ZipArchive::ER_INCONS:
            return sprintf("Zip archive '%s' is inconsistent.", $file);
        case ZipArchive::ER_INVAL:
            return sprintf("Invalid argument (%s)", $file);
        case ZipArchive::ER_MEMORY:
            return sprintf("Malloc failure (%s)", $file);
        case ZipArchive::ER_NOENT:
            return sprintf("No such zip file: '%s'", $file);
        case ZipArchive::ER_NOZIP:
            return sprintf("'%s' is not a zip archive.", $file);
        case ZipArchive::ER_OPEN:
            return sprintf("Can't open zip file: %s", $file);
        case ZipArchive::ER_READ:
            return sprintf("Zip read error (%s)", $file);
        case ZipArchive::ER_SEEK:
            return sprintf("Zip seek error (%s)", $file);
        case -1:
            return sprintf("'%s' is a corrupted zip archive (0 bytes), try again.", $file);
        default:
            return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal