Completed
Pull Request — 1.x (#301)
by
unknown
04:37
created

AfterThrowingInterceptor::invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
ccs 0
cts 11
cp 0
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 8
nc 2
nop 1
crap 6
1
<?php
2
/*
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2011, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Go\Aop\Framework;
12
13
use Exception;
14
use Go\Aop\AdviceAfter;
15
use Go\Aop\Intercept\Joinpoint;
16
17
/**
18
 * "After Throwing" interceptor
19
 *
20
 * @api
21
 */
22
final class AfterThrowingInterceptor extends BaseInterceptor implements AdviceAfter
23
{
24
    /**
25
     * After throwing exception invoker
26
     *
27
     * @param Joinpoint $joinpoint the concrete joinpoint
28
     *
29
     * @return mixed the result of the call to {@link Joinpoint::proceed()}
30
     * @throws Exception
31
     */
32
    public function invoke(Joinpoint $joinpoint)
33
    {
34
        try {
35
            $result = $joinpoint->proceed();
36
        } catch (Exception $invocationException) {
37
            $adviceMethod = $this->adviceMethod;
38
            $adviceMethod($joinpoint);
39
40
            throw $invocationException;
41
        }
42
43
        return $result;
44
    }
45
}
46