Completed
Pull Request — development (#565)
by Thomas
06:33
created

ChangelogController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A indexAction() 0 14 1
1
<?php
2
3
namespace AppBundle\Controller;
4
5
use League\CommonMark\CommonMarkConverter;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
7
use Symfony\Component\HttpFoundation\Response;
8
use Twig_Environment;
9
10
/**
11
 * @Route(service="app.controller.changelog_controller")
12
 * @package AppBundle\Controller
0 ignored issues
show
introduced by
Unexpected tag type @package in doc block
Loading history...
13
 */
14
class ChangelogController
15
{
16
    /**
17
     * @var CommonMarkConverter
0 ignored issues
show
introduced by
CommonMarkConverter => \League\CommonMark\CommonMarkConverter
Loading history...
18
     */
19
    private $markConverter;
20
21
    /**
22
     * @var Twig_Environment
0 ignored issues
show
introduced by
Twig_Environment => \Twig_Environment
Loading history...
23
     */
24
    private $twig;
25
26
    public function __construct(CommonMarkConverter $markConverter, Twig_Environment $twig)
27
    {
28
        $this->markConverter = $markConverter;
29
        $this->twig = $twig;
30
    }
31
32
    /**
33
     * @Route("/changelog")
34
     */
0 ignored issues
show
Coding Style Documentation introduced by
Missing @return tag in function comment
Loading history...
35
    public function indexAction()
0 ignored issues
show
introduced by
Method does not have a return statement in doc block: indexAction
Loading history...
36
    {
37
        $changelog = $this->markConverter->convertToHtml(file_get_contents(__DIR__ . '/../../../../ChangeLog-3.1.md'));
38
39
        $response = new Response();
40
        $response->setContent(
41
            $this->twig->render(
42
                'AppBundle:ChangelogController:index.html.twig',
43
                ['changelog' => $changelog]
44
            )
45
        );
46
47
        return $response;
48
    }
49
}
50