Conditions | 4 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4.0961 |
Changes | 0 |
1 | <?php |
||
38 | 7 | public function proceed() |
|
39 | { |
||
40 | 7 | if (isset($this->advices[$this->current])) { |
|
41 | 1 | $currentInterceptor = $this->advices[$this->current++]; |
|
42 | |||
43 | 1 | return $currentInterceptor->invoke($this); |
|
44 | } |
||
45 | |||
46 | // Fill the closure only once if it's empty |
||
47 | 7 | if ($this->closureToCall === null) { |
|
48 | 7 | $this->closureToCall = $this->reflectionMethod->getClosure($this->instance); |
|
49 | 7 | $this->previousInstance = $this->instance; |
|
50 | } |
||
51 | |||
52 | // Rebind the closure if instance was changed since last time |
||
53 | 7 | if ($this->previousInstance !== $this->instance) { |
|
54 | $this->closureToCall = $this->closureToCall->bindTo($this->instance, $this->reflectionMethod->class); |
||
55 | $this->previousInstance = $this->instance; |
||
56 | } |
||
57 | |||
58 | 7 | return ($this->closureToCall)(...$this->arguments); |
|
59 | } |
||
60 | } |
||
61 |