aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-14 19:58:31 +0900
committernsfisis <nsfisis@gmail.com>2026-05-14 19:58:31 +0900
commit0641930f6741ca144f85a3c30fbefd19c43ce09c (patch)
tree7cf2da94190af6bef977acc408ef0728134a8ce3 /crates/shirabe/src/downloader
parent2364b910b48b07e8a036c71fcc2e2dd7ab389eb7 (diff)
downloadphp-shirabe-0641930f6741ca144f85a3c30fbefd19c43ce09c.tar.gz
php-shirabe-0641930f6741ca144f85a3c30fbefd19c43ce09c.tar.zst
php-shirabe-0641930f6741ca144f85a3c30fbefd19c43ce09c.zip
feat(port): port TransportException.php
Diffstat (limited to 'crates/shirabe/src/downloader')
-rw-r--r--crates/shirabe/src/downloader/transport_exception.rs57
1 files changed, 57 insertions, 0 deletions
diff --git a/crates/shirabe/src/downloader/transport_exception.rs b/crates/shirabe/src/downloader/transport_exception.rs
index 375b3af..a7c64e1 100644
--- a/crates/shirabe/src/downloader/transport_exception.rs
+++ b/crates/shirabe/src/downloader/transport_exception.rs
@@ -1 +1,58 @@
//! ref: composer/src/Composer/Downloader/TransportException.php
+
+use shirabe_php_shim::PhpMixed;
+
+#[derive(Debug)]
+pub struct TransportException {
+ pub message: String,
+ pub code: i64,
+ pub(crate) headers: Option<Vec<String>>,
+ pub(crate) response: Option<String>,
+ pub(crate) status_code: Option<i64>,
+ pub(crate) response_info: Vec<PhpMixed>,
+}
+
+impl TransportException {
+ pub fn new(message: String, code: i64) -> Self {
+ Self {
+ message,
+ code,
+ headers: None,
+ response: None,
+ status_code: None,
+ response_info: vec![],
+ }
+ }
+
+ pub fn set_headers(&mut self, headers: Vec<String>) {
+ self.headers = Some(headers);
+ }
+
+ pub fn get_headers(&self) -> Option<&Vec<String>> {
+ self.headers.as_ref()
+ }
+
+ pub fn set_response(&mut self, response: Option<String>) {
+ self.response = response;
+ }
+
+ pub fn get_response(&self) -> Option<&str> {
+ self.response.as_deref()
+ }
+
+ pub fn set_status_code(&mut self, status_code: Option<i64>) {
+ self.status_code = status_code;
+ }
+
+ pub fn get_status_code(&self) -> Option<i64> {
+ self.status_code
+ }
+
+ pub fn get_response_info(&self) -> &Vec<PhpMixed> {
+ &self.response_info
+ }
+
+ pub fn set_response_info(&mut self, response_info: Vec<PhpMixed>) {
+ self.response_info = response_info;
+ }
+}