aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-14 19:56:55 +0900
committernsfisis <nsfisis@gmail.com>2026-05-14 19:56:55 +0900
commit5e5a7fd4b4162e569570264ceff88aa3f890ea30 (patch)
treee7eaceb03c6612f464d825016923c4626d668416
parent6ffb4b4db1da067ca88f98d8164940a570c2b2af (diff)
downloadphp-shirabe-5e5a7fd4b4162e569570264ceff88aa3f890ea30.tar.gz
php-shirabe-5e5a7fd4b4162e569570264ceff88aa3f890ea30.tar.zst
php-shirabe-5e5a7fd4b4162e569570264ceff88aa3f890ea30.zip
feat(port): port InstallerEvent.php
-rw-r--r--crates/shirabe/src/installer/installer_event.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/crates/shirabe/src/installer/installer_event.rs b/crates/shirabe/src/installer/installer_event.rs
index 88b08cf..3d0dccc 100644
--- a/crates/shirabe/src/installer/installer_event.rs
+++ b/crates/shirabe/src/installer/installer_event.rs
@@ -1 +1,50 @@
//! ref: composer/src/Composer/Installer/InstallerEvent.php
+
+use crate::composer::Composer;
+use crate::dependency_resolver::transaction::Transaction;
+use crate::event_dispatcher::event::Event;
+use crate::io::io_interface::IOInterface;
+
+#[derive(Debug)]
+pub struct InstallerEvent {
+ inner: Event,
+ composer: Composer,
+ io: Box<dyn IOInterface>,
+ dev_mode: bool,
+ execute_operations: bool,
+ transaction: Transaction,
+}
+
+impl InstallerEvent {
+ pub fn new(
+ event_name: String,
+ composer: Composer,
+ io: Box<dyn IOInterface>,
+ dev_mode: bool,
+ execute_operations: bool,
+ transaction: Transaction,
+ ) -> Self {
+ let inner = Event::new(event_name, vec![], vec![]);
+ Self { inner, composer, io, dev_mode, execute_operations, transaction }
+ }
+
+ pub fn get_composer(&self) -> &Composer {
+ &self.composer
+ }
+
+ pub fn get_io(&self) -> &dyn IOInterface {
+ self.io.as_ref()
+ }
+
+ pub fn is_dev_mode(&self) -> bool {
+ self.dev_mode
+ }
+
+ pub fn is_executing_operations(&self) -> bool {
+ self.execute_operations
+ }
+
+ pub fn get_transaction(&self) -> Option<&Transaction> {
+ Some(&self.transaction)
+ }
+}