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

AnnotationResolver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 22
Bugs 2 Features 8
Metric Value
wmc 2
c 22
b 2
f 8
lcom 1
cbo 2
dl 0
loc 45
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A resolve() 0 16 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