Passed
Push — dev ( c4f015...eeaa0f )
by Janko
27:51
created

LoggerUtilFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 2
dl 0
loc 4
ccs 1
cts 1
cp 1
crap 1
rs 10
c 1
b 1
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 4
    public function __construct(
14
        private StuConfigInterface $config,
15
        private Parser $parser
16
    ) {
17 4
    }
18
19 4
    #[Override]
20
    public function getLoggerUtil(bool $doDefaultInit = false): LoggerUtilInterface
21
    {
22 4
        $loggerUtil = new LoggerUtil(
23 4
            $this->config
24 4
        );
25
26 4
        if ($doDefaultInit) {
27
            $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 4
        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