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

TruePointcut::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
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\Pointcut;
12
13
use Go\Aop\Pointcut;
14
15
/**
16
 * Canonical Pointcut instance that always matches.
17
 */
18
class TruePointcut implements Pointcut
19
{
20
    use PointcutClassFilterTrait;
21
22
    /**
23
     * Filter kind
24
     *
25
     * @var int
26
     */
27
    protected $filterKind = 0;
28
29
    /**
30
     * Default constructor can be used to specify concrete filter kind
31
     *
32
     * @param int $filterKind Kind of filter, e.g. KIND_METHOD
33
     */
34
    public function __construct($filterKind = self::KIND_ALL)
35
    {
36
        $this->filterKind = $filterKind;
37
    }
38
39
    /**
40
     * Performs matching of point of code
41
     *
42
     * @param mixed $point Specific part of code, can be any Reflection class
43
     * @param null|mixed $context Related context, can be class or namespace
44
     * @param null|string|object $instance Invocation instance or string for static calls
45
     * @param null|array $arguments Dynamic arguments for method
46
     *
47
     * @return bool
48
     */
49
    public function matches($point, $context = null, $instance = null, array $arguments = null)
50
    {
51
        return true;
52
    }
53
54
    /**
55
     * Returns the kind of point filter
56
     *
57
     * @return integer
58
     */
59
    public function getKind()
60
    {
61
        return $this->filterKind;
62
    }
63
}
64