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

AnnotationBag::getMethodsAnnotations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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