Passed
Push — master ( be06f7...c027e3 )
by Wilmer
08:58 queued 06:59
created

ConnectionPool::getConnectionPool()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Connection;
6
7
class ConnectionPool
8
{
9
    private static array $connectionsPool = [];
10
11 577
    public static function getConnectionPool(string $key): ConnectionInterface
12
    {
13 577
        return static::$connectionsPool[$key];
0 ignored issues
show
Bug introduced by
Since $connectionsPool is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $connectionsPool to at least protected.
Loading history...
14
    }
15
16 577
    public static function setConnectionsPool(string $key, ConnectionInterface $config): void
17
    {
18 577
        static::$connectionsPool[$key] = $config;
0 ignored issues
show
Bug introduced by
Since $connectionsPool is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $connectionsPool to at least protected.
Loading history...
19 577
    }
20
}
21