20220406
This commit is contained in:
28
vendor/topthink/think-installer/src/LibraryInstaller.php
vendored
Normal file
28
vendor/topthink/think-installer/src/LibraryInstaller.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
11
vendor/topthink/think-installer/src/Promise.php
vendored
Normal file
11
vendor/topthink/think-installer/src/Promise.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace think\composer;
|
||||
|
||||
class Promise
|
||||
{
|
||||
public function then($callable)
|
||||
{
|
||||
$callable();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user