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');
|
throw new \UnexpectedValueException('Could not parse package list from the '.$this->url.' repository');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$loader = new ArrayLoader($this->repositoryManager);
|
||||||
foreach ($packages as $data) {
|
foreach ($packages as $data) {
|
||||||
$this->createPackages($data);
|
foreach ($data['versions'] as $rev) {
|
||||||
}
|
$this->addPackage($loader->load($rev));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createPackages($data)
|
|
||||||
{
|
|
||||||
foreach ($data['versions'] as $rev) {
|
|
||||||
$loader = new ArrayLoader($this->repositoryManager);
|
|
||||||
$this->addPackage($loader->load($rev));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,12 +58,7 @@ class GitRepository extends ArrayRepository
|
||||||
throw new \InvalidArgumentException('Could not find repository at url '.$this->url);
|
throw new \InvalidArgumentException('Could not find repository at url '.$this->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->createPackage($config);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function createPackage($data)
|
|
||||||
{
|
|
||||||
$loader = new ArrayLoader($this->repositoryManager);
|
$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);
|
$this->config = array($this->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$loader = new ArrayLoader($this->repositoryManager);
|
||||||
foreach ($this->config as $package) {
|
foreach ($this->config as $package) {
|
||||||
$loader = new ArrayLoader($this->repositoryManager);
|
|
||||||
$package = $loader->load($package);
|
$package = $loader->load($package);
|
||||||
$this->addPackage($package);
|
$this->addPackage($package);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ class PearRepository extends ArrayRepository
|
||||||
$packagesXML = $this->requestXml($this->url . $categoryLink);
|
$packagesXML = $this->requestXml($this->url . $categoryLink);
|
||||||
|
|
||||||
$packages = $packagesXML->getElementsByTagName('p');
|
$packages = $packagesXML->getElementsByTagName('p');
|
||||||
|
$loader = new ArrayLoader($this->repositoryManager);
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
$packageName = $package->nodeValue;
|
$packageName = $package->nodeValue;
|
||||||
|
|
||||||
|
@ -101,7 +102,6 @@ class PearRepository extends ArrayRepository
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$loader = new ArrayLoader($this->repositoryManager);
|
|
||||||
$this->addPackage($loader->load($packageData));
|
$this->addPackage($loader->load($packageData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue