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

AnnotationMetadataCollector::collect()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 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