Completed
Pull Request — master (#17)
by Luc
08:59 queued 05:48
created

QuestionViewController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A index() 0 8 2
1
<?php declare(strict_types=1);
2
3
namespace VSV\GVQ_API\Question\Controllers;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6
use Symfony\Component\HttpFoundation\Response;
7
use VSV\GVQ_API\Question\Repositories\QuestionRepository;
8
9
class QuestionViewController extends AbstractController
10
{
11
    /**
12
     * @var QuestionRepository
13
     */
14
    private $questionRepository;
15
16
    /**
17
     * @param QuestionRepository $questionRepository
18
     */
19
    public function __construct(QuestionRepository $questionRepository)
20
    {
21
        $this->questionRepository = $questionRepository;
22
    }
23
24
    /**
25
     * @return Response
26
     */
27
    public function index(): Response
28
    {
29
        $questions = $this->questionRepository->getAll();
30
31
        return $this->render(
32
            'questions/index.html.twig',
33
            [
34
                'questions' => $questions ? $questions->toArray() : [],
35
            ]
36
        );
37
    }
38
}
39