Rename abstract class back to the previously present SolverOperation, mark it internal, reintroduce some duplication

main
Jordi Boggiano 4 years ago
parent 140de5480d
commit 8d0596163c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -19,10 +19,30 @@ use Composer\Package\PackageInterface;
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class InstallOperation extends Operation implements OperationInterface
class InstallOperation extends SolverOperation implements OperationInterface
{
const TYPE = 'install';
/**
* @var PackageInterface
*/
protected $package;
public function __construct(PackageInterface $package)
{
$this->package = $package;
}
/**
* Returns package instance.
*
* @return PackageInterface
*/
public function getPackage()
{
return $this->package;
}
/**
* {@inheritDoc}
*/

@ -20,18 +20,28 @@ use Composer\Package\PackageInterface;
*
* @author Nils Adermann <naderman@naderman.de>
*/
class MarkAliasInstalledOperation extends Operation implements OperationInterface
class MarkAliasInstalledOperation extends SolverOperation implements OperationInterface
{
const TYPE = 'markAliasInstalled';
/**
* Initializes operation.
*
* @param AliasPackage $package package instance
* @var AliasPackage
*/
protected $package;
public function __construct(AliasPackage $package)
{
parent::__construct($package);
$this->package = $package;
}
/**
* Returns package instance.
*
* @return AliasPackage
*/
public function getPackage()
{
return $this->package;
}
/**

@ -20,18 +20,28 @@ use Composer\Package\PackageInterface;
*
* @author Nils Adermann <naderman@naderman.de>
*/
class MarkAliasUninstalledOperation extends Operation implements OperationInterface
class MarkAliasUninstalledOperation extends SolverOperation implements OperationInterface
{
const TYPE = 'markAliasUninstalled';
/**
* Initializes operation.
*
* @param AliasPackage $package package instance
* @var AliasPackage
*/
protected $package;
public function __construct(AliasPackage $package)
{
parent::__construct($package);
$this->package = $package;
}
/**
* Returns package instance.
*
* @return AliasPackage
*/
public function getPackage()
{
return $this->package;
}
/**

@ -19,35 +19,10 @@ use Composer\Package\PackageInterface;
*
* @author Aleksandr Bezpiatov <aleksandr.bezpiatov@spryker.com>
*/
abstract class Operation implements OperationInterface
abstract class SolverOperation implements OperationInterface
{
const TYPE = null;
/**
* @var PackageInterface
*/
protected $package;
/**
* Initializes operation.
*
* @param PackageInterface $package package instance
*/
public function __construct(PackageInterface $package)
{
$this->package = $package;
}
/**
* Returns package instance.
*
* @return PackageInterface
*/
public function getPackage()
{
return $this->package;
}
/**
* Returns operation type.
*

@ -19,10 +19,30 @@ use Composer\Package\PackageInterface;
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class UninstallOperation extends Operation implements OperationInterface
class UninstallOperation extends SolverOperation implements OperationInterface
{
const TYPE = 'uninstall';
/**
* @var PackageInterface
*/
protected $package;
public function __construct(PackageInterface $package)
{
$this->package = $package;
}
/**
* Returns package instance.
*
* @return PackageInterface
*/
public function getPackage()
{
return $this->package;
}
/**
* {@inheritDoc}
*/

@ -20,22 +20,28 @@ use Composer\Package\Version\VersionParser;
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class UpdateOperation extends Operation implements OperationInterface
class UpdateOperation extends SolverOperation implements OperationInterface
{
const TYPE = 'update';
/**
* @var PackageInterface
*/
protected $initialPackage;
/**
* Initializes update operation.
*
* @var PackageInterface
*/
protected $targetPackage;
/**
* @param PackageInterface $initial initial package
* @param PackageInterface $target target package (updated)
*/
public function __construct(PackageInterface $initial, PackageInterface $target)
{
$this->initialPackage = $initial;
parent::__construct($target);
$this->targetPackage = $target;
}
/**
@ -55,7 +61,7 @@ class UpdateOperation extends Operation implements OperationInterface
*/
public function getTargetPackage()
{
return $this->getPackage();
return $this->targetPackage;
}
/**
@ -63,7 +69,7 @@ class UpdateOperation extends Operation implements OperationInterface
*/
public function show($lock)
{
return self::format($this->initialPackage, $this->package, $lock);
return self::format($this->initialPackage, $this->targetPackage, $lock);
}
public static function format(PackageInterface $initialPackage, PackageInterface $targetPackage, $lock = false)

Loading…
Cancel
Save