OracleHelper::createConnection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 4
c 1
b 1
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\ActiveRecord\Tests\Support;
6
7
use PDO;
8
use Yiisoft\Db\Connection\ConnectionInterface;
9
use Yiisoft\Db\Oracle\Connection;
10
use Yiisoft\Db\Oracle\Driver;
11
12
final class OracleHelper extends ConnectionHelper
13
{
14
    private string $dsn = 'oci:dbname=localhost/XE;';
15
    private string $username = 'system';
16
    private string $password = 'root';
17
    private string $charset = 'AL32UTF8';
18
19
    public function createConnection(): ConnectionInterface
20
    {
21
        $pdoDriver = new Driver($this->dsn, $this->username, $this->password);
22
        $pdoDriver->charset($this->charset);
23
        $pdoDriver->attributes([PDO::ATTR_STRINGIFY_FETCHES => true]);
24
25
        return new Connection($pdoDriver, $this->createSchemaCache());
26
    }
27
}
28