Total Complexity | 7 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 76.47% |
Changes | 0 |
1 | <?php |
||
13 | final class SimplePayload implements PayloadInterface |
||
14 | { |
||
15 | /** |
||
16 | * The contents of the payload itself |
||
17 | * @var string |
||
18 | */ |
||
19 | private $payload = ''; |
||
20 | |||
21 | /** |
||
22 | * @var LoggerInterface |
||
23 | */ |
||
24 | private $logger; |
||
25 | |||
26 | 14 | public function __construct(string $messageContents = null, LoggerInterface $logger = null) |
|
27 | { |
||
28 | // Set the logger before setting the payload so that we already have it in the object |
||
29 | 14 | if ($logger === null) { |
|
30 | 14 | $logger = new DummyLogger(); |
|
31 | } |
||
32 | 14 | $this->logger = $logger; |
|
33 | |||
34 | 14 | if ($messageContents !== null) { |
|
35 | 14 | $this->setPayload($messageContents); |
|
36 | } |
||
37 | 14 | } |
|
38 | |||
39 | 14 | public function setPayload(string $contents): PayloadInterface |
|
40 | { |
||
41 | 14 | $this->payload = $contents; |
|
42 | 14 | $this->logger->debug('Setting contents of payload', ['contents' => $contents]); |
|
43 | 14 | return $this; |
|
44 | } |
||
45 | |||
46 | public function getPayload(): string |
||
47 | { |
||
48 | return $this->payload; |
||
49 | } |
||
50 | |||
51 | public function processIncomingPayload(string $contents): PayloadInterface |
||
54 | } |
||
55 | |||
56 | 7 | public function getProcessedPayload(): string |
|
59 | } |
||
60 | } |
||
61 |