Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
48 | private function isInjectable(ServerRequestInterface $request) |
||
49 | { |
||
50 | if (!Middleware::hasAttribute($request, FormatNegotiator::KEY)) { |
||
51 | throw new RuntimeException('This middleware needs FormatNegotiator executed before'); |
||
52 | } |
||
53 | |||
54 | //Must be html |
||
55 | if (FormatNegotiator::getFormat($request) !== 'html') { |
||
56 | return false; |
||
57 | } |
||
58 | |||
59 | //And not ajax |
||
60 | if (strtolower($request->getHeaderLine('X-Requested-With')) === 'xmlhttprequest') { |
||
61 | return false; |
||
62 | } |
||
63 | |||
64 | return true; |
||
65 | } |
||
66 | } |
||
67 |