Passed
Push — master ( e4ea99...6d7b4b )
by Nícollas
01:12
created

CRUD::update()   B

Complexity

Conditions 8
Paths 48

Size

Total Lines 27
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 20
c 0
b 0
f 0
nc 48
nop 4
dl 0
loc 27
rs 8.4444

1 Method

Rating   Name   Duplication   Size   Complexity  
A CRUD::delete() 0 8 2
1
<?php
2
3
namespace SimplePHP\Model;
4
5
trait CRUD {
6
    /**
7
     * @param int $primary
8
     * @return null|bool
9
     */
10
    public function delete(int $primary): ?bool
11
    {
12
        try {
13
            $sql = $this->conn->prepare("DELETE FROM {$this->table} WHERE {$this->primary} = :primary");
14
            $sql->bindParam(':primary', $primary);
15
            return $sql->execute();
16
        } catch(PDOException $exception) {
0 ignored issues
show
Bug introduced by
The type SimplePHP\Model\PDOException was not found. Did you mean PDOException? If so, make sure to prefix the type with \.
Loading history...
17
            return null;
18
        }
19
    }
20
}