PostgresConnection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 13
ccs 4
cts 6
cp 0.6667
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getExceptionType() 0 11 3
1
<?php
2
3
namespace mindplay\sql\postgres;
4
5
use mindplay\sql\exceptions\ForeignKeyException;
6
use mindplay\sql\exceptions\SQLException;
7
use mindplay\sql\exceptions\UniqueConstraintException;
8
use mindplay\sql\framework\pdo\PDOConnection;
9
10
class PostgresConnection extends PDOConnection
11
{
12 1
    public function getExceptionType(string $sql_state, int $error_code, string $error_message): string
13
    {
14
        switch ($sql_state) {
15 1
            case '23503':
16
                return ForeignKeyException::class;
17
18 1
            case '23505':
19
                return UniqueConstraintException::class;
20
21
            default:
22 1
                return SQLException::class;
23
        }
24
    }
25
}
26