Completed
Push — master ( 13c79d...44d82c )
by Vitaly
04:50 queued 02:36
created

AnnotationResolver::resolve()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 14
Bugs 0 Features 6
Metric Value
c 14
b 0
f 6
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 6
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 07.08.16 at 13:32
5
 */
6
namespace samsonframework\container\resolver;
7
8
use samsonframework\container\metadata\ClassMetadata;
9
10
/**
11
 * Annotation resolver implementation.
12
 *
13
 * @package samsonframework\container\resolver
14
 */
15
class AnnotationResolver implements Resolver
16
{
17
    /** @var AnnotationResolverInterface */
18
    protected $classResolver;
19
20
    /** @var AnnotationResolverInterface */
21
    protected $propertyResolver;
22
23
    /** @var AnnotationResolverInterface */
24
    protected $methodResolver;
25
26
    /**
27
     * AnnotationResolver constructor.
28
     *
29
     * @param AnnotationResolverInterface $classResolver
30
     * @param AnnotationResolverInterface $propertyResolver
31
     * @param AnnotationResolverInterface $methodResolver
32
     */
33 1
    public function __construct(AnnotationResolverInterface $classResolver, AnnotationResolverInterface $propertyResolver, AnnotationResolverInterface $methodResolver)
34
    {
35 1
        $this->classResolver = $classResolver;
36 1
        $this->propertyResolver = $propertyResolver;
37 1
        $this->methodResolver = $methodResolver;
38 1
    }
39
40
    /**
41
     * {@inheritDoc}
42
     */
43 1
    public function resolve($classData, $identifier = null)
44
    {
45
        /** @var \ReflectionClass $classData */
46
47
        // Create and fill class metadata base fields
48 1
        $classMetadata = new ClassMetadata();
49
50
        // Resolve class definition annotations
51 1
        $this->classResolver->resolve($classData, $classMetadata);
52
        // Resolve class properties annotations
53 1
        $this->propertyResolver->resolve($classData, $classMetadata);
54
        // Resolve class methods annotations
55 1
        $this->methodResolver->resolve($classData, $classMetadata);
56
57 1
        return $classMetadata;
58
    }
59
}
60