-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathErrorResult.php
73 lines (62 loc) · 1.58 KB
/
ErrorResult.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
<?php
/*
* This file is part of the Klipper package.
*
* (c) François Pluchino <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Klipper\Component\SmsSender\Transport;
use Klipper\Component\SmsSender\Mime\Phone;
/**
* Success result of the transport.
*
* @author François Pluchino <[email protected]>
*/
class ErrorResult extends AbstractResultItem
{
private string $message;
private string $code;
private ?\Throwable $throwable;
/**
* @param Phone $recipient The recipient
* @param string $message The error message
* @param string $code The error code
* @param array $data The error data
* @param null|\Throwable $throwable The exception
*/
public function __construct(
Phone $recipient,
string $message,
string $code,
array $data = [],
?\Throwable $throwable = null
) {
parent::__construct($recipient, $data);
$this->message = $message;
$this->code = $code;
$this->throwable = $throwable;
}
/**
* Get the error message.
*/
public function getMessage(): string
{
return $this->message;
}
/**
* Get the error data.
*/
public function getCode(): string
{
return $this->code;
}
/**
* Get the exception.
*/
public function getThrowable(): ?\Throwable
{
return $this->throwable;
}
}