Skip to content

Commit

Permalink
Merge pull request #290 from vtsykun/fix/proxy-repo
Browse files Browse the repository at this point in the history
Decorate composer repository
  • Loading branch information
vtsykun authored Nov 2, 2024
2 parents fe4e554 + ec6a4d0 commit 8a5e0c1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Composer/Repository/ComposerProxyRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

use Composer\Config;
use Composer\IO\IOInterface;
use Composer\Repository\ArrayRepository;
use Composer\Repository\ComposerRepository;
use Composer\Util\HttpDownloader;
use Composer\Util\ProcessExecutor;

class ComposerProxyRepository extends ComposerRepository implements PacketonRepositoryInterface
class ComposerProxyRepository extends ArrayRepository implements PacketonRepositoryInterface
{
private string $packageName;
private ComposerRepository $repository;

public function __construct(
protected array $repoConfig,
Expand All @@ -21,8 +23,9 @@ public function __construct(
protected HttpDownloader $httpDownloader,
protected ?ProcessExecutor $process = null
) {
parent::__construct($repoConfig, $io, $config, $httpDownloader);
parent::__construct();

$this->repository = new ComposerRepository($repoConfig, $io, $config, $httpDownloader);
$this->packageName = $this->repoConfig['packageName'];
$this->process ??= new ProcessExecutor($this->io);
}
Expand All @@ -34,7 +37,7 @@ public function getHttpDownloader(): HttpDownloader

public function getPackages(): array
{
return $this->findPackages($this->packageName);
return $this->repository->findPackages($this->packageName);
}

public function getProcessExecutor(): ProcessExecutor
Expand All @@ -51,4 +54,9 @@ public function getIO(): IOInterface
{
return $this->io;
}

public function getRepoConfig()
{
return $this->repository->getRepoConfig();
}
}

0 comments on commit 8a5e0c1

Please sign in to comment.