Passed
Push — master ( 4cbcfa...1ee8de )
by Nico
53:18 queued 29:25
created

LoggerUtilFactory::getLoggerUtil()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0116

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 11
ccs 6
cts 7
cp 0.8571
crap 2.0116
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Logging;
6
7
use Stu\Module\Config\StuConfigInterface;
8
9
final class LoggerUtilFactory implements LoggerUtilFactoryInterface
10
{
11 4
    public function __construct(
12
        private StuConfigInterface $config
13
    ) {
14 4
    }
15
16 4
    public function getLoggerUtil(bool $doDefaultInit = false): LoggerUtilInterface
17
    {
18 4
        $loggerUtil = new LoggerUtil(
19 4
            $this->config
20 4
        );
21
22 4
        if ($doDefaultInit) {
23
            $loggerUtil->init('STU', LoggerEnum::LEVEL_ERROR);
24
        }
25
26 4
        return $loggerUtil;
27
    }
28
}
29