Completed
Push — 1.x ( adc7c3...201c0c )
by Alexander
05:59 queued 01:58
created

AbstractGenericPointcutAdvisor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 62.5%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 41
ccs 5
cts 8
cp 0.625
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getAdvice() 0 4 1
A __toString() 0 6 1
1
<?php
2
/*
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2012, 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\Support;
12
13
use Go\Aop\Advice;
14
use Go\Aop\PointcutAdvisor;
15
16
/**
17
 * Abstract generic PointcutAdvisor that allows for any Advice to be configured.
18
 */
19
abstract class AbstractGenericPointcutAdvisor implements PointcutAdvisor
20
{
21
    /**
22
     * Instance of advice
23
     *
24
     * @var Advice
25
     */
26
    protected $advice;
27
28
    /**
29
     * Initializes an advisor with advice
30
     *
31
     * @param Advice $advice Advice to apply
32
     */
33 2
    public function __construct(Advice $advice)
34
    {
35 2
        $this->advice = $advice;
36 2
    }
37
38
    /**
39
     * Returns an advice to apply
40
     *
41
     * @return Advice|null
42
     */
43 2
    public function getAdvice()
44
    {
45 2
        return $this->advice;
46
    }
47
48
    /**
49
     * Return string representation of object
50
     *
51
     * @return string
52
     */
53
    public function __toString()
54
    {
55
        $adviceClass = get_class($this->getAdvice());
56
57
        return get_called_class() . ": advice [{$adviceClass}]";
58
    }
59
}
60