Completed
Push — master ( 4abeb4...389562 )
by Guilh
9s
created

TemplatingExceptionController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 1
c 3
b 1
f 0
lcom 0
cbo 1
dl 0
loc 26
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
findTemplate() 0 1 ?
A __construct() 0 10 1
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\Controller;
13
14
use FOS\RestBundle\View\ViewHandlerInterface;
15
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
16
use Symfony\Component\HttpFoundation\Request;
17
use Symfony\Component\Templating\TemplateReferenceInterface;
18
19
abstract class TemplatingExceptionController extends ExceptionController
20
{
21
    protected $templating;
22
23 4
    public function __construct(
24
        ViewHandlerInterface $viewHandler,
25
        array $exceptionCodes,
26
        $showException,
27
        EngineInterface $templating
28
    ) {
29 4
        parent::__construct($viewHandler, $exceptionCodes, $showException);
30
31 4
        $this->templating = $templating;
32 4
    }
33
34
    /**
35
     * Finds the template for the given format and status code.
36
     *
37
     * @param Request $request
38
     * @param int     $statusCode
39
     * @param bool    $showException
40
     *
41
     * @return TemplateReferenceInterface
42
     */
43
    abstract protected function findTemplate(Request $request, $statusCode, $showException);
44
}
45