blob: cade304648df4b6e2a49a8167bca2ae4c99eb9b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
//! ref: composer/vendor/symfony/console/Event/ConsoleEvent.php
use crate::symfony::console::command::command::Command;
use crate::symfony::console::input::input_interface::InputInterface;
use crate::symfony::console::output::output_interface::OutputInterface;
use crate::symfony::contracts::event_dispatcher::event::Event;
/// Allows to inspect input and output of a command.
#[derive(Debug)]
pub struct ConsoleEvent {
inner: Event,
pub(crate) command: Option<Box<dyn Command>>,
input: Box<dyn InputInterface>,
output: Box<dyn OutputInterface>,
}
impl ConsoleEvent {
pub fn new(
command: Option<Box<dyn Command>>,
input: Box<dyn InputInterface>,
output: Box<dyn OutputInterface>,
) -> Self {
Self {
inner: Event,
command,
input,
output,
}
}
pub fn get_command(&self) -> Option<&dyn Command> {
self.command.as_deref()
}
pub fn get_input(&self) -> &dyn InputInterface {
self.input.as_ref()
}
pub fn get_output(&self) -> &dyn OutputInterface {
self.output.as_ref()
}
}
|