You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
802 B
29 lines
802 B
<?php
|
|
|
|
namespace think\composer;
|
|
|
|
use Composer\Package\PackageInterface;
|
|
use Composer\Repository\InstalledRepositoryInterface;
|
|
use React\Promise\PromiseInterface;
|
|
|
|
abstract class LibraryInstaller extends \Composer\Installer\LibraryInstaller
|
|
{
|
|
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
|
|
{
|
|
return $this->makePromise(parent::install($repo, $package));
|
|
}
|
|
|
|
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
|
|
{
|
|
return $this->makePromise(parent::update($repo, $initial, $target));
|
|
}
|
|
|
|
protected function makePromise($promise)
|
|
{
|
|
if ($promise instanceof PromiseInterface) {
|
|
return $promise;
|
|
}
|
|
return new Promise();
|
|
}
|
|
}
|