MssqlHelper::createConnection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 3
c 1
b 1
f 0
dl 0
loc 6
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 Yiisoft\Db\Connection\ConnectionInterface;
8
use Yiisoft\Db\Mssql\Connection;
9
use Yiisoft\Db\Mssql\Driver;
10
11
final class MssqlHelper extends ConnectionHelper
12
{
13
    private string $dsn = 'sqlsrv:Server=127.0.0.1,1433;Database=yiitest';
14
    private string $username = 'SA';
15
    private string $password = 'YourStrong!Passw0rd';
16
    private string $charset = 'UTF8';
17
18
    public function createConnection(): ConnectionInterface
19
    {
20
        $pdoDriver = new Driver($this->dsn, $this->username, $this->password);
21
        $pdoDriver->charset($this->charset);
22
23
        return new Connection($pdoDriver, $this->createSchemaCache());
24
    }
25
}
26