/
MailgunBounce.php
76 lines (68 loc) · 1.5 KB
/
MailgunBounce.php
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
class MailgunBounce implements MailgunObject
{
private $_address;
private $_code;
private $_error;
private $_createDt;
/**
* @param array $data
* @return MailgunBounce
*/
public static function load($data)
{
$bounce = new self($data['address'], $data['code'], $data['error']);
$bounce->_createDt = new DateTime($data['created_at']);
return $bounce;
}
/**
* @param string $address User’s email address
* @param int $code Error code (default 550)
* @param string $error Error description (default is empty)
*/
public function __construct($address, $code = 550, $error = null)
{
$this->_address = $address;
$this->_code = $code;
$this->_error = $error;
}
/**
* @return array POST-data for Mailgun API request
*/
public function getPostData()
{
return array(
'address' => $this->_address,
'code' => $this->_code,
'error' => $this->_error,
);
}
/**
* @return string
*/
public function getAddress()
{
return $this->_address;
}
/**
* @return int
*/
public function getCode()
{
return $this->_code;
}
/**
* @return string
*/
public function getError()
{
return $this->_error;
}
/**
* @return DateTime
*/
public function getCreateDt()
{
return $this->_createDt;
}
}