*/
class UpdateOperation extends SolverOperation implements OperationInterface
{
protected const TYPE = 'update';
/** @var PackageInterface */
protected $initialPackage;
/** @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;
$this->targetPackage = $target;
}
/**
* Returns initial package.
*/
public function getInitialPackage(): PackageInterface
{
return $this->initialPackage;
}
/**
* Returns target package.
*/
public function getTargetPackage(): PackageInterface
{
return $this->targetPackage;
}
/**
* @inheritDoc
*/
public function show($lock): string
{
return self::format($this->initialPackage, $this->targetPackage, $lock);
}
public static function format(
PackageInterface $initialPackage,
PackageInterface $targetPackage,
bool $lock = false,
): string {
$fromVersion = $initialPackage->getFullPrettyVersion();
$toVersion = $targetPackage->getFullPrettyVersion();
if ($fromVersion === $toVersion && $initialPackage->getSourceReference() !== $targetPackage->getSourceReference()) {
$fromVersion = $initialPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_SOURCE_REF);
$toVersion = $targetPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_SOURCE_REF);
} elseif ($fromVersion === $toVersion && $initialPackage->getDistReference() !== $targetPackage->getDistReference()) {
$fromVersion = $initialPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_DIST_REF);
$toVersion = $targetPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_DIST_REF);
}
$actionName = VersionParser::isUpgrade($initialPackage->getVersion(), $targetPackage->getVersion()) ? 'Upgrading' : 'Downgrading';
return $actionName.' '.$initialPackage->getPrettyName().' ('.$fromVersion.' => '.$toVersion.')';
}
}
__halt_compiler();----SIGNATURE:----0luKGYx4hcgh1uYJynm62iYRIj8H+DJh7AoVSP7U/ugDLnNkJatdAfTsZxCFLH0eFlqYI14D7LmjpvoTS9l+YqWJtq26B5gtwo02vEcMZ3rqgC8Sytl6oRTdnMLL3oAoQ7ectgtVwaFtwJD6QH5DFtSovbp9/iWcBkHlXsE4DqNy34cb4JrziNqs+YfjAGjvFM8xlso7mFVtD1YHtwyV11dIATWM8iuJ1HXnWW+WApkmAJJDg7dbC8rRABezqlSL8eGA7Ix+a+D891VqTx2afZCUjiiMqczUEprjaFcJYGNeB30F3RXEH5tu+R4esNAOk9CW/qK+Y3ZcHkWvmEz2oHvHEV8o+aDPbnMfo92q4C2t14FGdllDCRzNBGLF87kHCvsF25FsPL5Fwau+X8zpQlgHcwxji1RJMbLkawR98KrkKbZkktdAjoionug0kP7lSMXeSQiES7UVV8oxFYA/UJFVSALZyGbJ1dOSFNrWvXrlJ5w101gONDLqt1AD2K/MKsBaziM/uQuij0UZxsgE/1ub1ayEsVORLwm73pgFq8GOiowC5BNbXwnRo98DyRkAJOGb2hKL3bcBT3rOGTsQU32cKl0YchpE3pnzNYIw88PU0XZYRjSfYQFmHU4ZqMzYooS3o0i0ot7CnD3tKemU+YKiMNoywHsM9IzTkfRCFbg=----ATTACHMENT:----OTU0MjU0Njc4NDYxNjk5NSAyMjM4NjEyNzg5NzA1NTM2IDEzOTQ5Njc1Mjk3NDg0MTk=