
Pointcuts compose joinpoints like predicates, using:
|| (or), && (and) and ! (not).
In the following example, we intercept all constructions of an Account instance and all executions of the methods from the Account class except the login method:
pointcut ensureAuthorization:(new(Account(0)) || exec(public Account::*(*)))
&& !exec(public Account::login(2));The following example shows the flexibily of the poincut syntax
Example 6.1: Pointcuts syntax.
<?php
aspect Security{
pointcut accountConstruction:new(Account(0));
pointcut accountExecution:exec(public Account::*(*));
around(): (accountConstruction || accountExecution)
and !exec(public Account::login(2)){
//Ensure Authorization...
}
}
?>