1 | <?php |
||
11 | final class Bind implements BindInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | private $bindings = []; |
||
17 | |||
18 | /** |
||
19 | * @var AnnotationReader |
||
20 | */ |
||
21 | private $reader; |
||
22 | |||
23 | 32 | public function __construct() |
|
27 | |||
28 | /** |
||
29 | * @param string $class |
||
30 | * @param array $pointcuts |
||
31 | * |
||
32 | * @return $this |
||
33 | */ |
||
34 | 30 | public function bind($class, array $pointcuts) |
|
1 ignored issue
–
show
|
|||
35 | { |
||
36 | 30 | $pointcuts = $this->getAnnotationPointcuts($pointcuts); |
|
37 | 30 | $this->annotatedMethodsMatch(new \ReflectionClass($class), $pointcuts); |
|
38 | |||
39 | 30 | return $this; |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param ReflectionClass $class |
||
44 | * @param Pointcut[] $pointcuts |
||
45 | */ |
||
46 | 30 | private function annotatedMethodsMatch(\ReflectionClass $class, array &$pointcuts) |
|
53 | |||
54 | /** |
||
55 | * @param ReflectionClass $class |
||
56 | * @param ReflectionMethod $method |
||
57 | * @param Pointcut[] $pointcuts |
||
58 | */ |
||
59 | 30 | private function annotatedMethodMatch(\ReflectionClass $class, \ReflectionMethod $method, array $pointcuts) |
|
76 | |||
77 | /** |
||
78 | * @param ReflectionClass $class |
||
79 | * @param ReflectionMethod $method |
||
80 | * @param PointCut $pointCut |
||
81 | */ |
||
82 | 30 | private function annotatedMethodMatchBind(\ReflectionClass $class, \ReflectionMethod $method, PointCut $pointCut) |
|
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | 30 | public function bindInterceptors($method, array $interceptors) |
|
99 | { |
||
100 | 30 | $this->bindings[$method] = !isset($this->bindings[$method]) ? $interceptors : array_merge( |
|
101 | 3 | $this->bindings[$method], |
|
102 | $interceptors |
||
103 | 3 | ); |
|
104 | |||
105 | 30 | return $this; |
|
106 | } |
||
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | 26 | public function getBindings() |
|
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | public function toString($salt) |
||
127 | |||
128 | /** |
||
129 | * @param Pointcut[] $pointcuts |
||
130 | * |
||
131 | * @return Pointcut[] |
||
132 | */ |
||
133 | 30 | public function getAnnotationPointcuts(array &$pointcuts) |
|
145 | |||
146 | /** |
||
147 | * @param ReflectionClass $class |
||
148 | * @param ReflectionMethod $method |
||
149 | * @param Pointcut[] $pointcuts |
||
150 | * @param array $annotations |
||
151 | * |
||
152 | * @return array |
||
153 | */ |
||
154 | 30 | private function onionOrderMatch( |
|
171 | } |
||
172 |