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

LoggerUtilFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 13
dl 0
loc 33
ccs 16
cts 16
cp 1
rs 10
c 1
b 1
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPirateLogger() 0 11 1
A __construct() 0 4 1
A getLoggerUtil() 0 12 2
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