Completed
Pull Request — master (#1376)
by Guilh
08:48 queued 06:22
created

TemplatingExceptionController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 7
nc 1
nop 4
crap 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