Completed
Push — master ( 01582c...42d944 )
by Vitaly
02:30
created

AnnotationMetadataCollector   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A collect() 0 11 2
1
<?php declare(strict_types = 1);
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 20.08.16 at 12:39
5
 */
6
namespace samsonframework\container;
7
8
/**
9
 * Annotation class metadata collector.
10
 * Class resolves and collects class metadata from annotations.
11
 *
12
 * @author Vitaly Egorov <[email protected]>
13
 */
14
class AnnotationMetadataCollector extends AbstractMetadataCollector
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19 1
    public function collect($classes) : array
20
    {
21
        /** @var array $classes */
22 1
        $classesMetadata = [];
23
24 1
        foreach ($classes as $className) {
25 1
            $classesMetadata[] = $this->resolver->resolve(new \ReflectionClass($className));
0 ignored issues
show
Bug introduced by
The property resolver does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
26
        }
27
28 1
        return $classesMetadata;
29
    }
30
}
31