Completed
Push — master ( 3309bb...059e5b )
by Changwan
02:58
created

AnnotationBag   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 65
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 6
lcom 2
cbo 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getClassAnnotations() 0 4 1
A getPropertiesAnnotations() 0 4 1
A getPropertyAnnotations() 0 4 1
A getMethodsAnnotations() 0 4 1
A getMethodAnnotations() 0 4 1
1
<?php
2
namespace Wandu\Annotation;
3
4
class AnnotationBag
5
{
6
    /** @var array */
7
    protected $classAnnos;
8
    
9
    /** @var array[] */
10
    protected $propAnnos;
11
    
12
    /** @var array[] */
13
    protected $methodAnnos;
14
15
    /**
16
     * @param array $classAnnos
17
     * @param array $propAnnos
18
     * @param array $methodAnnos
19
     */
20 1
    public function __construct(array $classAnnos, array $propAnnos, array $methodAnnos)
21
    {
22 1
        $this->classAnnos = $classAnnos;
23 1
        $this->propAnnos = $propAnnos;
24 1
        $this->methodAnnos = $methodAnnos;
25 1
    }
26
27
    /**
28
     * @return array
29
     */
30 1
    public function getClassAnnotations(): array
31
    {
32 1
        return $this->classAnnos;
33
    }
34
35
    /**
36
     * @return array
37
     */
38 1
    public function getPropertiesAnnotations(): array
39
    {
40 1
        return $this->propAnnos;
41
    }
42
43
    /**
44
     * @param string $name
45
     * @return array
46
     */
47 1
    public function getPropertyAnnotations(string $name): array
48
    {
49 1
        return $this->propAnnos[$name] ?? [];
50
    }
51
52
    /**
53
     * @return array
54
     */
55 1
    public function getMethodsAnnotations(): array
56
    {
57 1
        return $this->methodAnnos;
58
    }
59
60
    /**
61
     * @param string $name
62
     * @return array
63
     */
64 1
    public function getMethodAnnotations(string $name): array
65
    {
66 1
        return $this->methodAnnos[$name] ?? [];
67
    }
68
}
69