Merge pull request #68 from fabpot/small-opt
Move loader creation to avoid creating it more than once, unified the waypull/66/merge
commit
305856f2f5
|
@ -43,16 +43,11 @@ class ComposerRepository extends ArrayRepository
|
|||
throw new \UnexpectedValueException('Could not parse package list from the '.$this->url.' repository');
|
||||
}
|
||||
|
||||
foreach ($packages as $data) {
|
||||
$this->createPackages($data);
|
||||
}
|
||||
}
|
||||
|
||||
private function createPackages($data)
|
||||
{
|
||||
foreach ($data['versions'] as $rev) {
|
||||
$loader = new ArrayLoader($this->repositoryManager);
|
||||
foreach ($packages as $data) {
|
||||
foreach ($data['versions'] as $rev) {
|
||||
$this->addPackage($loader->load($rev));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,12 +58,7 @@ class GitRepository extends ArrayRepository
|
|||
throw new \InvalidArgumentException('Could not find repository at url '.$this->url);
|
||||
}
|
||||
|
||||
$this->createPackage($config);
|
||||
}
|
||||
|
||||
protected function createPackage($data)
|
||||
{
|
||||
$loader = new ArrayLoader($this->repositoryManager);
|
||||
$this->addPackage($loader->load($data));
|
||||
$this->addPackage($loader->load($config));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ class PackageRepository extends ArrayRepository
|
|||
$this->config = array($this->config);
|
||||
}
|
||||
|
||||
foreach ($this->config as $package) {
|
||||
$loader = new ArrayLoader($this->repositoryManager);
|
||||
foreach ($this->config as $package) {
|
||||
$package = $loader->load($package);
|
||||
$this->addPackage($package);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ class PearRepository extends ArrayRepository
|
|||
$packagesXML = $this->requestXml($this->url . $categoryLink);
|
||||
|
||||
$packages = $packagesXML->getElementsByTagName('p');
|
||||
$loader = new ArrayLoader($this->repositoryManager);
|
||||
foreach ($packages as $package) {
|
||||
$packageName = $package->nodeValue;
|
||||
|
||||
|
@ -101,7 +102,6 @@ class PearRepository extends ArrayRepository
|
|||
}
|
||||
}
|
||||
|
||||
$loader = new ArrayLoader($this->repositoryManager);
|
||||
$this->addPackage($loader->load($packageData));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue