Total Complexity | 4 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class IgnoreErrorTransportWrapper extends AbstractTransport |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * @var AbstractTransport |
||
16 | */ |
||
17 | private $transport; |
||
18 | |||
19 | /** |
||
20 | * @var \Exception|null |
||
21 | */ |
||
22 | private $lastError = null; |
||
23 | |||
24 | /** |
||
25 | * IgnoreErrorTransportWrapper constructor. |
||
26 | * |
||
27 | * @param AbstractTransport $transport |
||
28 | */ |
||
29 | 1 | public function __construct(AbstractTransport $transport) |
|
30 | { |
||
31 | 1 | $this->transport = $transport; |
|
32 | 1 | } |
|
33 | |||
34 | /** |
||
35 | * Sends a Message over this transport. |
||
36 | * |
||
37 | * @param Message $message |
||
38 | * |
||
39 | * @return int the number of bytes sent |
||
40 | */ |
||
41 | 1 | public function send(Message $message) |
|
42 | { |
||
43 | try { |
||
44 | 1 | return $this->transport->send($message); |
|
45 | 1 | } catch (\Exception $e) { |
|
46 | 1 | $this->lastError = $e; |
|
47 | 1 | return 0; |
|
48 | } |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Returns the last error |
||
53 | * @return \Exception|null |
||
54 | */ |
||
55 | 1 | public function getLastError() |
|
58 | } |
||
59 | } |
||
60 |