diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-12 04:01:37 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-12 04:01:37 +0900 |
| commit | 81a677bb2c11c105a14f7232c2a707ed4a7b7641 (patch) | |
| tree | 49d068bc3711c4e5a3b5da67a2f75754d4025afe /crates/shirabe/src/dependency_resolver | |
| parent | 902afb512b99f241ad028780862fea0f08d2bb9d (diff) | |
| download | php-shirabe-81a677bb2c11c105a14f7232c2a707ed4a7b7641.tar.gz php-shirabe-81a677bb2c11c105a14f7232c2a707ed4a7b7641.tar.zst php-shirabe-81a677bb2c11c105a14f7232c2a707ed4a7b7641.zip | |
feat(port): port MarkAliasUninstalledOperation.php
Diffstat (limited to 'crates/shirabe/src/dependency_resolver')
| -rw-r--r-- | crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs b/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs index c4dce95..68f18c4 100644 --- a/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs +++ b/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs @@ -1 +1,44 @@ //! ref: composer/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.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 MarkAliasUninstalledOperation { + pub(crate) package: AliasPackage, +} + +impl MarkAliasUninstalledOperation { + pub fn new(package: AliasPackage) -> Self { + Self { package } + } + + pub fn get_package(&self) -> &AliasPackage { + &self.package + } +} + +impl SolverOperation for MarkAliasUninstalledOperation { + const TYPE: &'static str = "markAliasUninstalled"; +} + +impl OperationInterface for MarkAliasUninstalledOperation { + fn get_operation_type(&self) -> String { + Self::TYPE.to_string() + } + + fn show(&self, _lock: bool) -> String { + format!( + "Marking <info>{}</info> (<comment>{}</comment>) as uninstalled, alias of <info>{}</info> (<comment>{}</comment>)", + 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) + } +} |
