class ZipDownloader extends ArchiveDownloader (View source)

Properties

protected $io from FileDownloader
protected $config from FileDownloader
protected $rfs from FileDownloader
protected $filesystem from FileDownloader
protected $cache from FileDownloader
protected $outputProgress from FileDownloader
static protected $hasSystemUnzip
protected $process

Methods

__construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)

Constructor.

string
getInstallationSource()

Returns installation source (either source or dist).

download(PackageInterface $package, string $path, $output = true)

Downloads specific package into specific folder.

doDownload(PackageInterface $package, $path, $url)

No description

setOutputProgress(bool $outputProgress)

Sets whether to output download progress information or not

clearLastCacheWrite(PackageInterface $package)

No description

update(PackageInterface $initial, PackageInterface $target, string $path)

Updates specific package in specific folder from initial to target version.

remove(PackageInterface $package, string $path, $output = true)

Removes specific package from specific folder.

string
getFileName(PackageInterface $package, string $path)

Gets file name for specific package

string
processUrl(PackageInterface $package, string $url)

Process the download url

string|null
getLocalChanges(PackageInterface $package, $targetDir)

Checks for changes to the local copy

extract(string $file, string $path)

extract $file to $path

bool
extractWithSystemUnzip(string $file, string $path, bool $isLastChance)

extract $file to $path with "unzip" command

bool
extractWithZipArchive(string $file, string $path, bool $isLastChance)

extract $file to $path with ZipArchive

string
getErrorMessage(int $retval, string $file)

Give a meaningful error message to the user.

Details

__construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)

Constructor.

Parameters

IOInterface $io The IO instance
Config $config The config
EventDispatcher $eventDispatcher The event dispatcher
Cache $cache Optional cache instance
ProcessExecutor $process
RemoteFilesystem $rfs The remote filesystem

string getInstallationSource()

Returns installation source (either source or dist).

Return Value

string "source" or "dist"

download(PackageInterface $package, string $path, $output = true)

Downloads specific package into specific folder.

Parameters

PackageInterface $package package instance
string $path download path
$output

protected doDownload(PackageInterface $package, $path, $url)

Parameters

PackageInterface $package
$path
$url

DownloaderInterface setOutputProgress(bool $outputProgress)

Sets whether to output download progress information or not

Parameters

bool $outputProgress

Return Value

DownloaderInterface

protected clearLastCacheWrite(PackageInterface $package)

Parameters

PackageInterface $package

update(PackageInterface $initial, PackageInterface $target, string $path)

Updates specific package in specific folder from initial to target version.

Parameters

PackageInterface $initial initial package
PackageInterface $target updated package
string $path download path

remove(PackageInterface $package, string $path, $output = true)

Removes specific package from specific folder.

Parameters

PackageInterface $package package instance
string $path download path
$output

protected string getFileName(PackageInterface $package, string $path)

Gets file name for specific package

Parameters

PackageInterface $package package instance
string $path download path

Return Value

string file name

protected string processUrl(PackageInterface $package, string $url)

Process the download url

Parameters

PackageInterface $package package the url is coming from
string $url download url

Return Value

string url

Exceptions

RuntimeException If any problem with the url

string|null getLocalChanges(PackageInterface $package, $targetDir)

Checks for changes to the local copy

Parameters

PackageInterface $package package instance
$targetDir

Return Value

string|null changes or null

extract(string $file, string $path)

extract $file to $path

Parameters

string $file Extracted file
string $path Directory

protected bool extractWithSystemUnzip(string $file, string $path, bool $isLastChance)

extract $file to $path with "unzip" command

Parameters

string $file File to extract
string $path Path where to extract file
bool $isLastChance If true it is called as a fallback and should throw an exception

Return Value

bool Success status

protected bool extractWithZipArchive(string $file, string $path, bool $isLastChance)

extract $file to $path with ZipArchive

Parameters

string $file File to extract
string $path Path where to extract file
bool $isLastChance If true it is called as a fallback and should throw an exception

Return Value

bool Success status

protected string getErrorMessage(int $retval, string $file)

Give a meaningful error message to the user.

Parameters

int $retval
string $file

Return Value

string