From b21e16434be1b7bf86a7fd31184998425a6ee9bf Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 15 May 2026 00:31:49 +0900 Subject: feat(port): port Event.php --- crates/shirabe/src/event_dispatcher/event.rs | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'crates') diff --git a/crates/shirabe/src/event_dispatcher/event.rs b/crates/shirabe/src/event_dispatcher/event.rs index ea059c9..81ab921 100644 --- a/crates/shirabe/src/event_dispatcher/event.rs +++ b/crates/shirabe/src/event_dispatcher/event.rs @@ -1 +1,43 @@ //! ref: composer/src/Composer/EventDispatcher/Event.php + +use indexmap::IndexMap; +use shirabe_php_shim::PhpMixed; + +#[derive(Debug)] +pub struct Event { + pub(crate) name: String, + pub(crate) args: Vec, + pub(crate) flags: IndexMap, + propagation_stopped: bool, +} + +impl Event { + pub fn new(name: String, args: Vec, flags: IndexMap) -> Self { + Self { + name, + args, + flags, + propagation_stopped: false, + } + } + + pub fn get_name(&self) -> &str { + &self.name + } + + pub fn get_arguments(&self) -> &Vec { + &self.args + } + + pub fn get_flags(&self) -> &IndexMap { + &self.flags + } + + pub fn is_propagation_stopped(&self) -> bool { + self.propagation_stopped + } + + pub fn stop_propagation(&mut self) { + self.propagation_stopped = true; + } +} -- cgit v1.3.1