From 902afb512b99f241ad028780862fea0f08d2bb9d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 12 May 2026 04:01:08 +0900 Subject: feat(port): port MarkAliasInstalledOperation.php --- .../operation/mark_alias_installed_operation.rs | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'crates/shirabe/src/dependency_resolver') diff --git a/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs b/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs index 5a12856..6788c44 100644 --- a/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs +++ b/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs @@ -1 +1,44 @@ //! ref: composer/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php + +use crate::dependency_resolver::operation::operation_interface::OperationInterface; +use crate::dependency_resolver::operation::solver_operation::SolverOperation; +use crate::package::alias_package::AliasPackage; + +#[derive(Debug)] +pub struct MarkAliasInstalledOperation { + pub(crate) package: AliasPackage, +} + +impl MarkAliasInstalledOperation { + pub fn new(package: AliasPackage) -> Self { + Self { package } + } + + pub fn get_package(&self) -> &AliasPackage { + &self.package + } +} + +impl SolverOperation for MarkAliasInstalledOperation { + const TYPE: &'static str = "markAliasInstalled"; +} + +impl OperationInterface for MarkAliasInstalledOperation { + fn get_operation_type(&self) -> String { + Self::TYPE.to_string() + } + + fn show(&self, _lock: bool) -> String { + format!( + "Marking {} ({}) as installed, alias of {} ({})", + self.package.get_pretty_name(), + self.package.get_full_pretty_version(), + self.package.get_alias_of().get_pretty_name(), + self.package.get_alias_of().get_full_pretty_version(), + ) + } + + fn to_string(&self) -> String { + self.show(true) + } +} -- cgit v1.3.1