Completed
Push — master ( ea4d28...78698c )
by Lukas Kahwe
07:31
created

FOSRestController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getViewHandler() 0 8 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\Controller;
13
14
use FOS\RestBundle\View\ViewHandlerInterface;
15
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
16
17
/**
18
 * Controllers using the View functionality of FOSRestBundle.
19
 *
20
 * @author Lukas Kahwe Smith <[email protected]>
21
 */
22
abstract class FOSRestController extends Controller
23
{
24
    use ControllerTrait;
25
26
    /**
27
     * Get the ViewHandler.
28
     *
29
     * @return ViewHandlerInterface
30
     */
31
    protected function getViewHandler()
32
    {
33
        if (!$this->viewhandler instanceof ViewHandlerInterface) {
34
            $this->viewhandler = $this->container->get('fos_rest.view_handler');
35
        }
36
37
        return $this->viewhandler;
38
    }
39
}
40