Completed
Pull Request — 2.x (#349)
by Alexander
02:20
created

AbstractGenericAdvisor::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types = 1);
3
/*
4
 * Go! AOP framework
5
 *
6
 * @copyright Copyright 2012, Lisachenko Alexander <[email protected]>
7
 *
8
 * This source file is subject to the license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Go\Aop\Support;
13
14
use Go\Aop\Advice;
15
use Go\Aop\Advisor;
16
17
/**
18
 * Abstract generic PointcutAdvisor that allows for any Advice to be configured.
19
 */
20
abstract class AbstractGenericAdvisor implements Advisor
21
{
22
    /**
23
     * Instance of advice
24
     *
25
     * @var Advice
26
     */
27
    protected $advice;
28
29
    /**
30
     * Initializes an advisor with advice
31
     *
32
     * @param Advice $advice Advice to apply
33
     */
34 2
    public function __construct(Advice $advice)
35
    {
36 2
        $this->advice = $advice;
37 2
    }
38
39
    /**
40
     * Returns an advice to apply
41
     */
42 2
    public function getAdvice(): Advice
43
    {
44 2
        return $this->advice;
45
    }
46
}
47