Passed
Push — dev ( 392257...472d6e )
by Janko
10:08
created

LoggerUtilFactory::getLoggerUtil()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 12
ccs 7
cts 7
cp 1
crap 2
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 JBBCode\Parser;
8
use Override;
0 ignored issues
show
Bug introduced by
The type Override 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...
9
use Stu\Module\Config\StuConfigInterface;
10
11
final class LoggerUtilFactory implements LoggerUtilFactoryInterface
12
{
13 2
    public function __construct(
14
        private StuConfigInterface $config,
15
        private Parser $parser
16
    ) {
17 2
    }
18
19 9
    #[Override]
20
    public function getLoggerUtil(bool $doDefaultInit = false): LoggerUtilInterface
21
    {
22 9
        $loggerUtil = new LoggerUtil(
23 9
            $this->config
24 9
        );
25
26 9
        if ($doDefaultInit) {
27 1
            $loggerUtil->init('STU', LoggerEnum::LEVEL_ERROR);
0 ignored issues
show
Bug introduced by
The type Stu\Module\Logging\LoggerEnum 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...
28
        }
29
30 9
        return $loggerUtil;
31
    }
32
33 1
    #[Override]
34
    public function getPirateLogger(): PirateLoggerInterface
35
    {
36 1
        $loggerUtil = new PirateLogger(
37 1
            $this->config,
38 1
            $this->parser
39 1
        );
40
41 1
        $loggerUtil->initRotating();
42
43 1
        return $loggerUtil;
44
    }
45
}
46