Completed
Push — master ( 81d64a...3349a8 )
by Francesco
03:06
created

Demo::highlightDemoAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
cc 1
eloc 13
nc 1
nop 0
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 demo 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