Completed
Push — master ( 3349a8...bfc52a )
by Francesco
04:06 queued 48s
created

DemoController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A highlightDemoAction() 0 23 1
1
<?php
2
3
/*
4
 * This file is part of the MesHighlightBundle package.
5
 *
6
 * (c) Francesco Cartenì <http://www.multimediaexperiencestudio.it/>
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 Mes\Misc\HighlightBundle\Controller;
13
14
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
15
use Symfony\Component\HttpFoundation\Response;
16
17
/**
18
 * Class HighlightDemoController.
19
 */
20
class DemoController extends Controller
21
{
22
    /**
23
     * @return Response
24
     */
25
    public function highlightDemoAction()
26
    {
27
        $root = dirname($this->get('kernel')
28
                             ->locateResource('@MesHighlightBundle/MesHighlightBundle.php'));
29
30
        // Change root path for "code files".
31
        $this->get('mes_highlight.highlighter')
32
             ->setRootPath($root);
33
34
        // Add js language for highlighting.
35
        $this->get('mes_highlight.highlighter')
36
             ->addSupportedLanguages(array(
37
                 'js',
38
                 'xml',
39
                 'http',
40
             ));
41
42
        $content = '{{Resources/demo/demo.php}}';
43
44
        return $this->render('MesHighlightBundle::demo.html.twig', array(
45
            'content' => $content,
46
        ));
47
    }
48
}
49