diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-14 19:51:11 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-14 19:51:11 +0900 |
| commit | d5c9d8d6abe901e9b7258fd74fdc9dcc29d9dcab (patch) | |
| tree | ba4aabec6ab6a3c551503ba64f02cc276b372b42 /crates/shirabe/src | |
| parent | 34ff0250aca29044181251a6763916bd55433962 (diff) | |
| download | php-shirabe-d5c9d8d6abe901e9b7258fd74fdc9dcc29d9dcab.tar.gz php-shirabe-d5c9d8d6abe901e9b7258fd74fdc9dcc29d9dcab.tar.zst php-shirabe-d5c9d8d6abe901e9b7258fd74fdc9dcc29d9dcab.zip | |
feat(port): port CommandEvent.php
Diffstat (limited to 'crates/shirabe/src')
| -rw-r--r-- | crates/shirabe/src/plugin/command_event.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/crates/shirabe/src/plugin/command_event.rs b/crates/shirabe/src/plugin/command_event.rs index cce8f98..0eb952a 100644 --- a/crates/shirabe/src/plugin/command_event.rs +++ b/crates/shirabe/src/plugin/command_event.rs @@ -1 +1,40 @@ //! ref: composer/src/Composer/Plugin/CommandEvent.php + +use shirabe_external_packages::symfony::console::input::input_interface::InputInterface; +use shirabe_external_packages::symfony::console::output::output_interface::OutputInterface; +use crate::event_dispatcher::event::Event; +use shirabe_php_shim::PhpMixed; + +#[derive(Debug)] +pub struct CommandEvent { + inner: Event, + command_name: String, + input: Box<dyn InputInterface>, + output: Box<dyn OutputInterface>, +} + +impl CommandEvent { + pub fn new( + name: String, + command_name: String, + input: Box<dyn InputInterface>, + output: Box<dyn OutputInterface>, + args: Vec<PhpMixed>, + flags: Vec<PhpMixed>, + ) -> Self { + let inner = Event::new(name, args, flags); + Self { inner, command_name, input, output } + } + + pub fn get_input(&self) -> &dyn InputInterface { + self.input.as_ref() + } + + pub fn get_output(&self) -> &dyn OutputInterface { + self.output.as_ref() + } + + pub fn get_command_name(&self) -> &str { + &self.command_name + } +} |
