ExamEditModel   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A edit() 0 15 1
1
<?php
2
3
namespace Egzaminer\Model;
4
5
use PDO;
6
7
class ExamEditModel extends AbstractModel
8
{
9
    public function edit(int $examID, array $post): bool
10
    {
11
        $stmt = $this->db->prepare(
12
            'UPDATE exams SET title = :title,
13
            questions = :questions, threshold = :threshold, group_id = :group_id
14
            WHERE id = :id'
15
        );
16
        $stmt->bindValue(':title', trim($post['title']));
17
        $stmt->bindValue(':questions', $post['questions'], PDO::PARAM_INT);
18
        $stmt->bindValue(':threshold', $post['threshold'], PDO::PARAM_INT);
19
        $stmt->bindValue(':group_id', $post['group_id'], PDO::PARAM_INT);
20
        $stmt->bindValue(':id', $examID, PDO::PARAM_INT);
21
22
        return $stmt->execute();
23
    }
24
}
25