PgsqlPdo   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 74
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 3

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
A getTables() 0 4 1
A getColumns() 0 4 1
A getForeignKeys() 0 4 1
A getTableCounts() 0 4 1
A getFieldComment() 0 4 1
1
<?php declare(strict_types=1);
2
/**
3
 * @package Terah\FluentPdoModel
4
 *
5
 * Licensed under The MIT License
6
 * For full copyright and license information, please see the LICENSE.txt
7
 * Redistributions of files must retain the above copyright notice.
8
 *
9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
10
 */
11
12
namespace Terah\FluentPdoModel\Drivers;
13
14
use \PDO;
15
use Psr\Log\LoggerInterface;
16
use Psr\Log\NullLogger;
17
use Terah\FluentPdoModel\Column;
18
use Terah\FluentPdoModel\ForeignKey;
19
use Terah\RedisCache\CacheInterface;
20
use Terah\RedisCache\NullCache;
21
22
/**
23
 * Class PgsqlPdo
24
 *
25
 * @package Terah\FluentPdoModel\Drivers
26
 * @author  Terry Cullen <[email protected]>
27
 */
28
class PgsqlPdo extends AbstractPdo implements DriverInterface
29
{
30
    /** @var bool  */
31
    protected $_supportsColumnMeta = true;
32
33
    /**
34
     * PgsqlPdo constructor.
35
     * @param string $dsn
36
     * @param string $username
37
     * @param string $password
38
     * @param array $options
39
     * @param LoggerInterface|null $logger
40
     * @param CacheInterface|null $cache
41
     */
42
    public function __construct(string $dsn, string $username='', string $password='', array $options=[], LoggerInterface $logger=null, CacheInterface $cache=null)
43
    {
44
        parent::__construct($dsn, $username, $password, $options);
45
        $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
46
        $this->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
47
        $this->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
48
        $this->setConfig($options, $dsn);
49
        $this->setLogger($logger ? $logger : new NullLogger());
50
        $this->setCache($cache ? $cache : new NullCache());
51
    }
52
53
54
    /**
55
     * @param bool $include_views
56
     * @return array
57
     */
58
    public function getTables(bool $include_views=false) : array
59
    {
60
        return [];
61
    }
62
63
    /**
64
     * @param bool $include_views
65
     * @param string $table
66
     * @return Column[]
67
     */
68
    public function getColumns(bool $include_views=false, string $table='') : array
69
    {
70
        return [];
71
    }
72
73
    /**
74
     * @param string $table
75
     * @return ForeignKey[]
76
     */
77
    public function getForeignKeys(string $table='') : array
78
    {
79
        return [];
80
    }
81
82
    /**
83
     * @param bool|false $include_views
84
     * @param string $table
85
     * @return array
86
     */
87
    public function getTableCounts(bool $include_views=false, string $table='') : array
88
    {
89
        return [];
90
    }
91
92
    /**
93
     * @param string $table
94
     * @param string $column
95
     * @return string
96
     */
97
    public function getFieldComment(string $table, string $column) : string
98
    {
99
        return '';
100
    }
101
}