[Request] Be more DRY
parent
6b5f61943a
commit
62bce6b9ed
|
@ -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,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue