| Total Complexity | 7 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| 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 | 18 | 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 | 18 | if ($logger === null) { |
|
| 30 | 18 | $logger = new DummyLogger(); |
|
| 31 | } |
||
| 32 | 18 | $this->logger = $logger; |
|
| 33 | |||
| 34 | 18 | if ($messageContents !== null) { |
|
| 35 | 15 | $this->setPayload($messageContents); |
|
| 36 | } |
||
| 37 | 18 | } |
|
| 38 | |||
| 39 | 17 | public function setPayload(string $contents): PayloadInterface |
|
| 44 | } |
||
| 45 | |||
| 46 | 3 | public function getPayload(): string |
|
| 47 | { |
||
| 48 | 3 | return $this->payload; |
|
| 49 | } |
||
| 50 | |||
| 51 | 1 | public function processIncomingPayload(string $contents): PayloadInterface |
|
| 52 | { |
||
| 53 | 1 | return $this->setPayload($contents); |
|
| 54 | } |
||
| 55 | |||
| 56 | 7 | public function getProcessedPayload(): string |
|
| 59 | } |
||
| 60 | } |
||
| 61 |