Completed
Push — master ( ac011d...56c397 )
by Mikołaj
03:19
created

ExamsGroupController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 14 2
1
<?php
2
3
namespace Egzaminer\Controller;
4
5
use Exception;
6
use Egzaminer\Model\ExamsGroupModel;
7
use Egzaminer\Model\ExamsListModel;
8
9
class ExamsGroupController extends AbstractController
10
{
11
    /**
12
     * Exams group index action.
13
     *
14
     * GET /group/[i:id]
15
     *
16
     * @param int $examID Exam ID
17
     *
18
     * @return void
19
     */
20
    public function indexAction($examID)
21
    {
22
        $list = new ExamsListModel($this->get('dbh'));
23
        $examsList = $list->getExamsByGroupId($examID);
24
25
        $one = new ExamsGroupModel($this->get('dbh'));
26
        $info = $one->getExamsGroupInfoById($examID);
27
28
        if (empty($info)) {
29
            throw new Exception('Exams group does not exist!');
30
        }
31
32
        $this->render('front/list', ['title' => $info->title, 'examsList' => $examsList]);
33
    }
34
}
35