aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/plugin/post_file_download_event.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-15 23:06:02 +0900
committernsfisis <nsfisis@gmail.com>2026-05-16 10:00:39 +0900
commita2a0772a205fa9c0472d82c42bdad5abdbd624be (patch)
tree11030ff2f347350d1c1ea7c1f0513d18d1128ec4 /crates/shirabe/src/plugin/post_file_download_event.rs
parent8142c4b61eef2047148b331550a413e532e7bd33 (diff)
downloadphp-shirabe-a2a0772a205fa9c0472d82c42bdad5abdbd624be.tar.gz
php-shirabe-a2a0772a205fa9c0472d82c42bdad5abdbd624be.tar.zst
php-shirabe-a2a0772a205fa9c0472d82c42bdad5abdbd624be.zip
feat(port): port PostFileDownloadEvent.php
Diffstat (limited to 'crates/shirabe/src/plugin/post_file_download_event.rs')
-rw-r--r--crates/shirabe/src/plugin/post_file_download_event.rs56
1 files changed, 56 insertions, 0 deletions
diff --git a/crates/shirabe/src/plugin/post_file_download_event.rs b/crates/shirabe/src/plugin/post_file_download_event.rs
index 72c68c3..f0e2569 100644
--- a/crates/shirabe/src/plugin/post_file_download_event.rs
+++ b/crates/shirabe/src/plugin/post_file_download_event.rs
@@ -1 +1,57 @@
//! ref: composer/src/Composer/Plugin/PostFileDownloadEvent.php
+
+use shirabe_php_shim::PhpMixed;
+
+use crate::event_dispatcher::event::Event;
+
+#[derive(Debug)]
+pub struct PostFileDownloadEvent {
+ inner: Event,
+ file_name: Option<String>,
+ checksum: Option<String>,
+ url: String,
+ context: PhpMixed,
+ r#type: String,
+}
+
+impl PostFileDownloadEvent {
+ pub fn new(
+ name: String,
+ file_name: Option<String>,
+ checksum: Option<String>,
+ url: String,
+ r#type: String,
+ context: PhpMixed,
+ ) -> Self {
+ Self {
+ inner: Event::new(name, vec![], indexmap::IndexMap::new()),
+ file_name,
+ checksum,
+ url,
+ context,
+ r#type,
+ }
+ }
+
+ pub fn get_file_name(&self) -> Option<&str> {
+ self.file_name.as_deref()
+ }
+
+ pub fn get_checksum(&self) -> Option<&str> {
+ self.checksum.as_deref()
+ }
+
+ pub fn get_url(&self) -> &str {
+ &self.url
+ }
+
+ pub fn get_context(&self) -> &PhpMixed {
+ &self.context
+ }
+
+ // TODO(plugin): getPackage is deprecated since Composer 2.1, use getContext instead
+
+ pub fn get_type(&self) -> &str {
+ &self.r#type
+ }
+}