Conditions | 4 |
Paths | 4 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function decode(ReadableMessage $message) |
||
23 | { |
||
24 | $bodyContent = $message->getRawBody(); |
||
25 | $contentType = $message->getContentType(); |
||
26 | |||
27 | switch($contentType) |
||
28 | { |
||
29 | case ContentType::TEXT: |
||
30 | return new Text($bodyContent); |
||
31 | |||
32 | case ContentType::JSON: |
||
33 | $body = new Json(); |
||
34 | $body->changeContentWithJson($bodyContent); |
||
35 | |||
36 | return $body; |
||
37 | |||
38 | case ContentType::BINARY: |
||
39 | return new Binary($bodyContent); |
||
40 | } |
||
41 | |||
42 | $this->logger->warning(__CLASS__ . ": unknown content-type, use empty body"); |
||
43 | |||
44 | return new NullBody(); |
||
45 | } |
||
46 | } |
||
47 |