1
0
Fork 0

Merge pull request #18 from stloyd/patch-1

[Request] Be more DRY
pull/19/merge
Jordi Boggiano 2011-09-17 07:26:37 -07:00
commit bcb4e58940
1 changed files with 6 additions and 5 deletions

View File

@ -29,27 +29,28 @@ class Request
public function install($packageName, LinkConstraintInterface $constraint = null)
{
$this->addJob(strtolower($packageName), 'install', $constraint);
$this->addJob($packageName, 'install', $constraint);
}
public function update($packageName, LinkConstraintInterface $constraint = null)
{
$this->addJob(strtolower($packageName), 'update', $constraint);
$this->addJob($packageName, 'update', $constraint);
}
public function remove($packageName, LinkConstraintInterface $constraint = null)
{
$this->addJob(strtolower($packageName), 'remove', $constraint);
$this->addJob($packageName, 'remove', $constraint);
}
protected function addJob($packageName, $cmd, LinkConstraintInterface $constraint = null)
{
$packages = $this->pool->whatProvides(strtolower($packageName), $constraint);
$packageName = strtolower($packageName);
$packages = $this->pool->whatProvides($packageName, $constraint);
$this->jobs[] = array(
'packages' => $packages,
'cmd' => $cmd,
'packageName' => strtolower($packageName),
'packageName' => $packageName,
);
}