Passed
Push — master ( 88983b...1e7624 )
by Wilmer
02:43
created

OracleHelper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 1
eloc 9
c 1
b 1
f 0
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createConnection() 0 7 1
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\ConnectionPDO;
10
use Yiisoft\Db\Oracle\PDODriver;
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 PDODriver($this->dsn, $this->username, $this->password);
22
        $pdoDriver->charset($this->charset);
23
        $pdoDriver->attributes([PDO::ATTR_STRINGIFY_FETCHES => true]);
24
25
        return new ConnectionPDO($pdoDriver, $this->createSchemaCache());
26
    }
27
}
28