ConnectionLocator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A new() 0 9 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Sirius\Orm;
5
6
class ConnectionLocator extends \Atlas\Pdo\ConnectionLocator
7
{
8
    public static function new(...$args)
9
    {
10
        if ($args[0] instanceof Connection) {
11
            return new ConnectionLocator(function () use ($args) {
12
                return $args[0];
13
            });
14
        }
15
16
        return new ConnectionLocator(Connection::factory(...$args));
17
    }
18
}
19