Completed
Push — master ( 45c651...8bfbde )
by Damien
02:27
created

LayersDebugController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 3
dl 21
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A layersDebug() 15 15 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * Veto.
4
 * PHP Microframework.
5
 *
6
 * @author Damien Walsh <[email protected]>
7
 * @copyright Damien Walsh 2013-2014
8
 * @version 0.1
9
 * @package veto
10
 */
11
namespace Veto\Debug\Controller;
12
13
use Veto\HTTP\Response;
14
use Veto\MVC\AbstractController;
15
16
/**
17
 * ListenersDebugController
18
 *
19
 * Controller to render a debug dump of the registered layers in the application.
20
 */
21 View Code Duplication
class LayersDebugController extends AbstractController
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
{
23
    /**
24
     * @return Response
25
     */
26
    public function layersDebug()
27
    {
28
        // The templates for showing exceptions are outside of the normal application
29
        // template path. It is therefore necessary to specify the path here.
30
        $this->get('php_template_engine')->addPath(
31
            __DIR__ . '/../Resources/LayersDebug'
32
        );
33
34
        // Render the template
35
        $response = $this->get('php_template_engine')->render('List.html.php', array(
36
            'layerPriorityGroups' => $this->container->get('chain')->getLayers()
37
        ));
38
39
        return new Response($response);
40
    }
41
}
42