Passed
Push — main ( 4ee80d...af755d )
by Dimitri
03:46
created

ConnectionResolver::connect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * This file is part of Blitz PHP framework.
5
 *
6
 * (c) 2022 Dimitri Sitchet Tomkeu <[email protected]>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace BlitzPHP\Db;
13
14
use BlitzPHP\Contracts\Database\ConnectionInterface;
15
use BlitzPHP\Contracts\Database\ConnectionResolverInterface;
0 ignored issues
show
Bug introduced by
The type BlitzPHP\Contracts\Datab...ectionResolverInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
17
class ConnectionResolver implements ConnectionResolverInterface
18
{
19
    protected string $defaultConnection = 'default';
20
21
    /**
22
     * {@inheritDoc}
23
     */
24
    public function connection(?string $name = null): ConnectionInterface
25
    {
26
        return $this->connect($name ?: $this->defaultConnection);
27
    }
28
    
29
    /**
30
     * {@inheritDoc}
31
     */
32
    public function connect($group = null, bool $shared = true): ConnectionInterface
33
    {
34
        return  Database::connect($group, $shared);
35
    }
36
37
    /**
38
     * {@inheritDoc}
39
     */
40
    public function connectionInfo(array|string|null $group = null): array
41
    {
42
        return Database::connectionInfo($group);
43
    }
44
45
    /**
46
     * {@inheritDoc}
47
     */
48
    public function getDefaultConnection(): string
49
    {
50
        return $this->defaultConnection;
51
    }
52
53
    /**
54
     * {@inheritDoc}
55
     */
56
    public function setDefaultConnection(string $name): void
57
    {
58
        $this->defaultConnection = $name;
59
    }
60
}