HostPortDbTrait::getDb()   A
last analyzed

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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 *  This file is part of the Micro framework package.
7
 *
8
 *  (c) Stanislau Komar <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace Micro\Plugin\Doctrine\Configuration\Driver;
15
16
trait HostPortDbTrait
17
{
18
    protected static string $CFG_HOST = 'ORM_%s_HOST';
19
    protected static string $CFG_PORT = 'ORM_%s_PORT';
20
    protected static string $CFG_DB = 'ORM_%s_DATABASE';
21
22 2
    public function getHost(): ?string
23
    {
24 2
        return $this->get(self::$CFG_HOST, '127.0.0.1', false);
0 ignored issues
show
Bug introduced by
The method get() does not exist on Micro\Plugin\Doctrine\Co...\Driver\HostPortDbTrait. Did you maybe mean getDb()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        return $this->/** @scrutinizer ignore-call */ get(self::$CFG_HOST, '127.0.0.1', false);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
    }
26
27 2
    public function getPort(int|null $default = null): ?int
28
    {
29 2
        return (int) $this->get(self::$CFG_PORT, $default) ?: null;
30
    }
31
32 2
    public function getDb(): string
33
    {
34 2
        return $this->get(self::$CFG_DB, null, false);
35
    }
36
}
37