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

CRUD   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A 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
}