Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
21 | 28 | public function create($contentType, $contentAsTransported) |
|
22 | { |
||
23 | switch($contentType) |
||
24 | { |
||
25 | 28 | case ContentType::TEXT: |
|
26 | 8 | return new Text($contentAsTransported); |
|
27 | |||
28 | 21 | case ContentType::JSON: |
|
29 | 3 | $body = new Json(); |
|
30 | 3 | $body->changeContentWithJson($contentAsTransported); |
|
31 | |||
32 | 3 | return $body; |
|
33 | |||
34 | 19 | case ContentType::BINARY: |
|
35 | 3 | return new Binary($contentAsTransported); |
|
36 | } |
||
37 | |||
38 | 16 | $this->logger->warning(__CLASS__ . ": unknown content-type, use empty body"); |
|
39 | |||
40 | 16 | return new NullBody(); |
|
41 | } |
||
42 | } |
||
43 |