Completed
Push — 1.x ( c183a4...05b51a )
by Alexander
8s
created

AfterThrowingInterceptor::invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 7
cts 7
cp 1
rs 9.4285
cc 2
eloc 8
nc 2
nop 1
crap 2
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 2
    public function invoke(Joinpoint $joinpoint)
33
    {
34
        try {
35 2
            $result = $joinpoint->proceed();
36 1
        } catch (Exception $invocationException) {
37 1
            $adviceMethod = $this->adviceMethod;
38 1
            $adviceMethod($joinpoint);
39
40 1
            throw $invocationException;
41
        }
42
43 1
        return $result;
44
    }
45
}
46