RequestListener::onKernelRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
namespace MewesK\TwigExcelBundle\EventListener;
4
5
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
6
7
/**
8
 * Class RequestListener
9
 *
10
 * @package MewesK\TwigExcelBundle\EventListener
11
 */
12
class RequestListener
13
{
14
    /**
15
     * @param GetResponseEvent $event
16
     */
17
    public function onKernelRequest(GetResponseEvent $event)
18
    {
19
        $event->getRequest()->setFormat('csv', 'text/csv');
20
        $event->getRequest()->setFormat('ods', 'application/vnd.oasis.opendocument.spreadsheet');
21
        $event->getRequest()->setFormat('pdf', 'application/pdf');
22
        $event->getRequest()->setFormat('xls', 'application/vnd.ms-excel');
23
        $event->getRequest()->setFormat('xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
24
    }
25
}
26