forked from php-db/phpdb-sqlite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigProvider.php
More file actions
64 lines (58 loc) · 2.36 KB
/
ConfigProvider.php
File metadata and controls
64 lines (58 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
declare(strict_types=1);
namespace PhpDb\Sqlite;
use PhpDb\Adapter\Driver\Pdo\Result;
use PhpDb\Adapter\Driver\Pdo\Statement;
use PhpDb\Adapter\Driver\PdoConnectionInterface;
use PhpDb\Adapter\Driver\PdoDriverInterface;
use PhpDb\Adapter\Driver\ResultInterface;
use PhpDb\Adapter\Driver\StatementInterface;
use PhpDb\Adapter\Platform\PlatformInterface;
use PhpDb\Metadata\MetadataInterface;
final class ConfigProvider
{
public function __invoke(): array
{
return [
'dependencies' => $this->getDependencies(),
//AdapterInterface::class => $this->getConfig(),
];
}
public function getConfig(): array
{
return [
'driver' => PdoDriverInterface::class,
'connection' => [
'dsn' => 'sqlite::memory:',
],
];
}
public function getDependencies(): array
{
return [
'aliases' => [
'SQLite' => Pdo\Driver::class,
'Sqlite' => Pdo\Driver::class,
'sqlite' => Pdo\Driver::class,
'pdo' => Pdo\Driver::class,
'pdo_sqlite' => Pdo\Driver::class,
'pdosqlite' => Pdo\Driver::class,
'pdodriver' => Pdo\Driver::class,
PdoConnectionInterface::class => Pdo\Connection::class,
PdoDriverInterface::class => Pdo\Driver::class,
PlatformInterface::class => AdapterPlatform::class,
ResultInterface::class => Result::class,
StatementInterface::class => Statement::class,
MetadataInterface::class => Metadata\Source::class,
],
'factories' => [
Pdo\Connection::class => Container\PdoConnectionFactory::class,
Pdo\Driver::class => Container\PdoDriverInterfaceFactory::class,
Result::class => Container\PdoResultFactory::class,
Statement::class => Container\PdoStatementFactory::class,
AdapterPlatform::class => Container\PlatformInterfaceFactory::class,
Metadata\Source::class => Container\MetadataInterfaceFactory::class,
],
];
}
}