Completed
Push — master ( 6744a4...ab6d26 )
by Guilh
7s
created

ExceptionListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A duplicateRequest() 0 12 2
1
<?php
2
3
/*
4
 * This file is part of the FOSRestBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\RestBundle\EventListener;
13
14
use Symfony\Component\HttpKernel\EventListener\ExceptionListener as HttpKernelExceptionListener;
15
use Symfony\Component\HttpFoundation\Request;
16
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
17
18
/**
19
 * ExceptionListener.
20
 *
21
 * @author Ener-Getick <[email protected]>
22
 *
23
 * @internal
24
 */
25
class ExceptionListener extends HttpKernelExceptionListener
26
{
27
    /**
28
     * {@inheritdoc}
29
     */
30 4
    protected function duplicateRequest(\Exception $exception, Request $request)
31
    {
32
        $attributes = array(
33 4
            '_controller' => $this->controller,
34 4
            'exception' => $exception,
35 4
            'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null,
36 4
        );
37 4
        $request = $request->duplicate(null, null, $attributes);
38 4
        $request->setMethod('GET');
39
40 4
        return $request;
41
    }
42
}
43