QuestionsModel::getByQuestionId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Egzaminer\Model;
4
5
use PDO;
6
7
class QuestionsModel extends AbstractModel
8
{
9
    public function getByExamId(int $examID): array
10
    {
11
        $stmt = $this->db->prepare('SELECT * FROM questions WHERE exam_id = :exam_id');
12
        $stmt->bindValue(':exam_id', $examID, PDO::PARAM_INT);
13
        $stmt->execute();
14
15
        return $stmt->fetchAll(PDO::FETCH_ASSOC);
16
    }
17
18
    public function getByQuestionId(int $questionID): array
19
    {
20
        $stmt = $this->db->prepare('SELECT * FROM questions WHERE id = :id');
21
        $stmt->bindValue(':id', $questionID, PDO::PARAM_INT);
22
        $stmt->execute();
23
24
        return $stmt->fetch(PDO::FETCH_ASSOC);
25
    }
26
}
27