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

AfterThrowingInterceptor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 24
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A invoke() 0 13 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