1
0
Fork 0

[Request] Be more DRY

pull/18/head
Joseph Bielawski 2011-09-17 17:18:49 +03:00
parent 6b5f61943a
commit 62bce6b9ed
1 changed files with 6 additions and 5 deletions

View File

@ -29,27 +29,28 @@ class Request
public function install($packageName, LinkConstraintInterface $constraint = null) 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) 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) 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) 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( $this->jobs[] = array(
'packages' => $packages, 'packages' => $packages,
'cmd' => $cmd, 'cmd' => $cmd,
'packageName' => strtolower($packageName), 'packageName' => $packageName,
); );
} }