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