Passed
Pull Request — master (#249)
by Wilmer
02:50
created

SqliteHelper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createConnection() 0 6 1
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\Sqlite\ConnectionPDO;
9
use Yiisoft\Db\Sqlite\PDODriver;
10
11
use function dirname;
12
13
final class SqliteHelper extends ConnectionHelper
14
{
15
    private string $charset = 'UTF8';
16
17
    public function createConnection(): ConnectionInterface
18
    {
19
        $pdoDriver = new PDODriver('sqlite::memory:');
20
        $pdoDriver->charset($this->charset);
21
22
        return new ConnectionPDO($pdoDriver, $this->createSchemaCache());
23
    }
24
}
25