Passed
Pull Request — 1.x (#334)
by Akihito
02:24
created

SemanticLoggerModule   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 5
c 1
b 0
f 1
dl 0
loc 12
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A configure() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Resource\SemanticLog\Module;
6
7
use BEAR\Resource\Invoker;
8
use BEAR\Resource\InvokerInterface;
9
use BEAR\Resource\SemanticLog\SemanticResourceInvokerAdapter;
10
use Koriym\SemanticLogger\SemanticLogger;
0 ignored issues
show
Bug introduced by
The type Koriym\SemanticLogger\SemanticLogger 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...
11
use Koriym\SemanticLogger\SemanticLoggerInterface;
0 ignored issues
show
Bug introduced by
The type Koriym\SemanticLogger\SemanticLoggerInterface 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...
12
use Override;
13
use Ray\Di\AbstractModule;
14
use Ray\Di\Scope;
15
16
final class SemanticLoggerModule extends AbstractModule
17
{
18
    #[Override]
19
    protected function configure(): void
20
    {
21
        $this->bind(SemanticLoggerInterface::class)->to(SemanticLogger::class)->in(Scope::SINGLETON);
22
23
        // Bind the original invoker with annotation so our adapter can inject it
24
        $this->bind(InvokerInterface::class)->annotatedWith('Original')->to(Invoker::class);
25
26
        // Override the default invoker with our semantic logging adapter
27
        $this->bind(InvokerInterface::class)->to(SemanticResourceInvokerAdapter::class);
28
    }
29
}
30