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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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;
}
}
|