Conditions | 5 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 8.125 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | 1 | public function handle($request, Closure $next, $isValidXml = false) |
|
21 | { |
||
22 | 1 | if ('xml' !== $request->getContentTypeFormat()) { |
|
23 | 1 | return response()->xml(['message' => 'Only accepting content of type XML.'], 415); |
|
24 | } |
||
25 | |||
26 | if ($isValidXml && $request->getContent() && ! LaravelXml::is_valid($request->getContent())) { |
||
|
|||
27 | return response()->xml(['message' => 'The given data was malformed.'], 400); |
||
28 | } |
||
29 | |||
30 | return $next($request); |
||
31 | } |
||
33 |