1 | <?php |
||
21 | class FunctionPointcut implements Pointcut |
||
22 | { |
||
23 | /** |
||
24 | * @var PointFilter |
||
25 | */ |
||
26 | protected $nsFilter; |
||
27 | |||
28 | /** |
||
29 | * Function name to match, can contain wildcards *,? |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $functionName = ''; |
||
34 | |||
35 | /** |
||
36 | * Regular expression for matching |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $regexp; |
||
41 | |||
42 | /** |
||
43 | * Additional return type filter (if present) |
||
44 | * |
||
45 | * @var PointFilter|null |
||
46 | */ |
||
47 | protected $returnTypeFilter; |
||
48 | |||
49 | /** |
||
50 | * Function matcher constructor |
||
51 | * |
||
52 | * @param string $functionName Name of the function to match or glob pattern |
||
53 | * @param PointFilter|null $returnTypeFilter Additional return type filter |
||
54 | */ |
||
55 | 4 | public function __construct(string $functionName, PointFilter $returnTypeFilter = null) |
|
64 | |||
65 | /** |
||
66 | * Performs matching of point of code |
||
67 | * |
||
68 | * @param mixed $function Specific part of code, can be any Reflection class |
||
69 | * @param mixed $context Related context, can be class or namespace |
||
70 | * @param null|string|object $instance Invocation instance or string for static calls |
||
71 | * @param null|array $arguments Dynamic arguments for method |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function matches($function, $context = null, $instance = null, array $arguments = null): bool |
||
87 | |||
88 | /** |
||
89 | * Returns the kind of point filter |
||
90 | */ |
||
91 | public function getKind(): int |
||
95 | |||
96 | /** |
||
97 | * Return the class filter for this pointcut. |
||
98 | */ |
||
99 | public function getClassFilter(): PointFilter |
||
103 | |||
104 | 4 | public function setNamespaceFilter($nsFilter) |
|
108 | } |
||
109 |