Filter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 14
c 0
b 0
f 0
dl 0
loc 44
ccs 14
cts 14
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A onInject() 0 4 1
A getAnnotationInfo() 0 3 1
A onMethodInject() 0 12 2
1
<?php
2
3
namespace WebStream\Annotation\Attributes;
4
5
use WebStream\Annotation\Base\Annotation;
6
use WebStream\Annotation\Base\IAnnotatable;
7
use WebStream\Annotation\Base\IMethods;
8
use WebStream\Annotation\Base\IRead;
9
use WebStream\Annotation\Container\AnnotationContainer;
10
use WebStream\Container\Container;
0 ignored issues
show
Bug introduced by
The type WebStream\Container\Container 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
12
/**
13
 * Filter
14
 * @author Ryuichi TANAKA.
15
 * @since 2013/10/20
16
 * @version 0.4
17
 *
18
 * @Annotation
19
 * @Target("METHOD")
20
 */
21
class Filter extends Annotation implements IMethods, IRead
22
{
23
    /**
24
     * @var array<string> 注入アノテーション情報
25
     */
26
    private array $injectAnnotation;
27
28
    /**
29
     * @var array<string> 読み込みアノテーション情報
30
     */
31
    private array $readAnnotation;
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 20
    public function onInject(array $injectAnnotation)
37
    {
38 20
        $this->injectAnnotation = $injectAnnotation;
39 20
        $this->readAnnotation = [];
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45 20
    public function getAnnotationInfo(): array
46
    {
47 20
        return $this->readAnnotation;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53 20
    public function onMethodInject(IAnnotatable $instance, \ReflectionMethod $method, Container $container)
54
    {
55 20
        $annotationContainer = new AnnotationContainer();
56 20
        foreach ($this->injectAnnotation as $key => $value) {
57 20
            $annotationContainer->{$key} = $value;
58
        }
59
60 20
        $this->readAnnotation = [
61 20
            'classpath' => get_class($instance),
62 20
            'action' => $container->action,
63 20
            'refMethod' => $method,
64 20
            'annotation' => $annotationContainer
65
        ];
66
    }
67
}
68