Passed
Push — master ( becae5...2d4555 )
by Jean Paul
12:24
created

PostgreSqlConnector::executeExtraStatements()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Coco\SourceWatcher\Core\Database\Connections;
4
5
use Doctrine\DBAL\Connection;
6
7
/**
8
 * Class PostgreSqlConnector
9
 *
10
 * @package Coco\SourceWatcher\Core\Database\Connections
11
 *
12
 * Following the definition from:
13
 *     https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#pdo-pgsql
14
 */
15
class PostgreSqlConnector extends ClientServerDatabaseConnector
16
{
17
    protected string $charset = "";
18
19
    protected string $defaultDatabaseName = "";
20
21
    protected string $sslMode = "";
22
23
    protected string $sslRootCert = "";
24
25
    protected string $sslCert = "";
26
27
    protected string $sslKey = "";
28
29
    protected string $sslCrl = "";
30
31
    protected string $applicationName = "";
32
33
    public function __construct ()
34
    {
35
        parent::__construct();
36
37
        $this->driver = "pdo_pgsql";
38
39
        $this->port = 5432;
40
    }
41
42
    public function getCharset () : string
43
    {
44
        return $this->charset;
45
    }
46
47
    public function setCharset ( string $charset ) : void
48
    {
49
        $this->charset = $charset;
50
    }
51
52
    public function getDefaultDatabaseName () : string
53
    {
54
        return $this->defaultDatabaseName;
55
    }
56
57
    public function setDefaultDatabaseName ( string $defaultDatabaseName ) : void
58
    {
59
        $this->defaultDatabaseName = $defaultDatabaseName;
60
    }
61
62
    public function getSslMode () : string
63
    {
64
        return $this->sslMode;
65
    }
66
67
    public function setSslMode ( string $sslMode ) : void
68
    {
69
        $this->sslMode = $sslMode;
70
    }
71
72
    public function getSslRootCert () : string
73
    {
74
        return $this->sslRootCert;
75
    }
76
77
    public function setSslRootCert ( string $sslRootCert ) : void
78
    {
79
        $this->sslRootCert = $sslRootCert;
80
    }
81
82
    public function getSslCert () : string
83
    {
84
        return $this->sslCert;
85
    }
86
87
    public function setSslCert ( string $sslCert ) : void
88
    {
89
        $this->sslCert = $sslCert;
90
    }
91
92
    public function getSslKey () : string
93
    {
94
        return $this->sslKey;
95
    }
96
97
    public function setSslKey ( string $sslKey ) : void
98
    {
99
        $this->sslKey = $sslKey;
100
    }
101
102
    public function getSslCrl () : string
103
    {
104
        return $this->sslCrl;
105
    }
106
107
    public function setSslCrl ( string $sslCrl ) : void
108
    {
109
        $this->sslCrl = $sslCrl;
110
    }
111
112
    public function getApplicationName () : string
113
    {
114
        return $this->applicationName;
115
    }
116
117
    public function setApplicationName ( string $applicationName ) : void
118
    {
119
        $this->applicationName = $applicationName;
120
    }
121
122
    public function getConnectionParameters () : array
123
    {
124
        $this->extraParameters = [
125
            "charset" => $this->charset,
126
            "default_dbname" => $this->defaultDatabaseName,
127
            "sslmode" => $this->sslMode,
128
            "sslrootcert" => $this->sslRootCert,
129
            "sslcert" => $this->sslCert,
130
            "sslkey" => $this->sslKey,
131
            "sslcrl" => $this->sslCrl,
132
            "application_name" => $this->applicationName
133
        ];
134
135
        return parent::getConnectionParameters();
136
    }
137
138
    protected function executeExtraStatements ( Connection $connection ) : void
139
    {
140
        // TODO: Implement executeExtraStatements() method.
141
    }
142
}
143