Completed
Push — logger ( 8c349b )
by Akihito
02:02
created

LggerModule::configure()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 3
nc 4
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Resource;
6
7
use Ray\Di\AbstractModule;
8
9
final class LggerModule extends AbstractModule
10
{
11
    const LOG_LEVEL_PROD = 0;
12
13
    const LOG_LEVEL_DEV = 1;
14
15
    const LOG_LEVEL_DEV_RESULT = 2;
16
17
    /**
18
     * @var string
19
     */
20
    private $level;
21
22
    /**
23
     * @var AbstractModule
24
     */
25
    private $module;
26
27
    public function __construct(string $level, AbstractModule $module)
28
    {
29
        $this->level = $level;
30
        $this->module = $module;
31
        parent::__construct($module);
32
    }
33
34
    protected function configure()
35
    {
36
        if ($this->level === self::LOG_LEVEL_PROD) {
0 ignored issues
show
Unused Code Bug introduced by
The strict comparison === seems to always evaluate to false as the types of $this->level (string) and self::LOG_LEVEL_PROD (integer) can never be identical. Maybe you want to use a loose comparison == instead?
Loading history...
37
            $this->bind(LoggerInterface::class)->to(ProdLogger::class);
38
        }
39
        if ($this->level === self::LOG_LEVEL_DEV) {
0 ignored issues
show
Unused Code Bug introduced by
The strict comparison === seems to always evaluate to false as the types of $this->level (string) and self::LOG_LEVEL_DEV (integer) can never be identical. Maybe you want to use a loose comparison == instead?
Loading history...
40
            $this->bind(LoggerInterface::class)->to(DevZeroLogger::class);
41
        }
42
        $this->bind(LoggerInterface::class)->to(DevOneLogger::class);
43
    }
44
}
45