| Conditions | 9 | 
| Paths | 7 | 
| Total Lines | 25 | 
| Code Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 13 | public static function fromSuperGlobals(string $inputStream = 'php://input'): Body  | 
            ||
| 14 |     { | 
            ||
| 15 | $content = file_get_contents($inputStream);  | 
            ||
| 16 | |||
| 17 |         if (empty($content) && empty($_POST)) { | 
            ||
| 18 | return new EmptyBody();  | 
            ||
| 19 | }  | 
            ||
| 20 | |||
| 21 |         if (!isset($_SERVER['CONTENT_TYPE']) || empty($_SERVER['CONTENT_TYPE'])) { | 
            ||
| 22 | return new RawBody($content);  | 
            ||
| 23 | }  | 
            ||
| 24 | |||
| 25 |         $contentType = explode(';', $_SERVER['CONTENT_TYPE']); | 
            ||
| 26 | |||
| 27 |         switch (reset($contentType)) { | 
            ||
| 28 | case ContentType::JSON:  | 
            ||
| 29 | case ContentType::JSON_UTF8:  | 
            ||
| 30 | return new JsonBody($content);  | 
            ||
| 31 | case ContentType::MULTIPART_FORMDATA:  | 
            ||
| 32 | return new FormDataBody($_POST);  | 
            ||
| 33 | case ContentType::PDF:  | 
            ||
| 34 | return new PdfBody($content);  | 
            ||
| 35 | }  | 
            ||
| 36 | throw new UnsupportedRequestBodyException();  | 
            ||
| 37 | }  | 
            ||
| 38 | |||
| 44 |