| Conditions | 4 |
| Paths | 2 |
| Total Lines | 6 |
| Code Lines | 2 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 3 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 43 | 5 | public function getFormatFromRequest(Request $request): string |
|
| 44 | { |
||
| 45 | // Symfony 6.2 deprecated getContentType in favor of getContentTypeFormat |
||
| 46 | 5 | $contentTypeMethod = method_exists($request, 'getContentTypeFormat') ? 'getContentTypeFormat' : 'getContentType'; |
|
| 47 | |||
| 48 | 5 | return $request->getRequestFormat(null) ?: $request->{$contentTypeMethod}() ?: $this->defaultFormat; |
|
| 49 | } |
||
| 51 |