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
84 lines (78 loc) · 3.5 KB
/
ConfigProvider.php
File metadata and controls
84 lines (78 loc) · 3.5 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
declare(strict_types=1);
namespace PhpDb\Adapter\Sqlite;
use Laminas\ServiceManager\Factory\InvokableFactory;
use PhpDb\Adapter\AdapterInterface;
use PhpDb\Adapter\Driver\ConnectionInterface;
use PhpDb\Adapter\Driver\DriverInterface;
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\Adapter\Profiler\Profiler;
use PhpDb\Adapter\Profiler\ProfilerInterface;
use PhpDb\Container\AdapterManager;
use PhpDb\Metadata\MetadataInterface;
use PhpDb\ResultSet;
final class ConfigProvider
{
public function __invoke(): array
{
return [
'dependencies' => $this->getDependencies(),
AdapterManager::class => $this->getAdapterManagerConfig(),
];
}
public function getDependencies(): array
{
return [
'aliases' => [
MetadataInterface::class => Metadata\Source\SqliteMetadata::class,
],
'factories' => [
Metadata\Source\SqliteMetadata::class => Container\MetadataInterfaceFactory::class,
],
'delegators' => [
AdapterManager::class => [
Container\AdapterManagerDelegator::class,
],
],
];
}
public function getAdapterManagerConfig(): array
{
return [
'aliases' => [
'SQLite' => Driver\Pdo\Pdo::class,
'Sqlite' => Driver\Pdo\Pdo::class,
'sqlite' => Driver\Pdo\Pdo::class,
'pdo' => Driver\Pdo\Pdo::class,
'pdo_sqlite' => Driver\Pdo\Pdo::class,
'pdosqlite' => Driver\Pdo\Pdo::class,
'pdodriver' => Driver\Pdo\Pdo::class,
ConnectionInterface::class => Driver\Pdo\Connection::class,
PdoConnectionInterface::class => Driver\Pdo\Connection::class,
DriverInterface::class => Driver\Pdo\Pdo::class,
PdoDriverInterface::class => Driver\Pdo\Pdo::class,
PlatformInterface::class => Platform\Sqlite::class,
ProfilerInterface::class => Profiler::class,
ResultInterface::class => Result::class,
ResultSet\ResultSetInterface::class => ResultSet\ResultSet::class,
StatementInterface::class => Statement::class,
],
'factories' => [
AdapterInterface::class => Container\AdapterFactory::class,
Driver\Pdo\Connection::class => Container\PdoConnectionFactory::class,
Driver\Pdo\Pdo::class => Container\PdoDriverFactory::class,
Result::class => Container\PdoResultFactory::class,
Statement::class => Container\PdoStatementFactory::class,
Platform\Sqlite::class => Container\PlatformInterfaceFactory::class,
Profiler::class => InvokableFactory::class,
ResultSet\ResultSet::class => InvokableFactory::class,
],
];
}
}