lisachenko/go-aop-php — pull request #142 by lisachenko (2014-04-08 19:22:46+00:00)
Title: [Feature] Allow to use advisors directly without serialization

This feature allows to specify custom interceptors with callbacks instead of aspects:

```php
protected function configureAop(AspectContainer $container)
{
$container->registerAdvisor(
new DefaultPointcutAdvisor(
new TrueMethodPointcut(),
new MethodBeforeInterceptor(function (MethodInvocation $invocation) {
echo "Hello", $invocation->getMethod()->name;
})
),
'test'
);
}
```

Additionally, this PR replaces unserialization of advices with direct injection of advices if possible. If advisor is not loaded, then special aspect cache is used with serialized advisors and pointcuts per each aspect. So, no more need to analyze annotations in case when a cache of advisors is active.

After merging of this PR it will be possible to create a pointcut builder with DSL and fluent interface. Example:

```php
protected function configureAop(AspectContainer $container)
{
$builder = new PointcutBuilder($container);
$builder->before('execution(public **->get(*)')->do(function (MethodInvocation $invocation) {
echo "Hello", $invocation->getMethod()->name;
});
$builder->after('access(protected **->propertyName')->do(function (FieldAccess $access) {
echo "Hello", $access->getField()->name;
});
}
```