lisachenko/go-aop-php — pull request #184 by lisachenko (2014-11-21 14:08:12+00:00)
Title: [Feature] Initialization pointcut support

This PR introduces an new feature for the framework: possibility to intercept a creation of new instance of object.

So, this joinpoint gives a control over `new XXX()` expressions in the code. Possible usage: automatic configurators (after creation of object XXX, set some specific values into properties), singletone pattern (each call to `new XXX` will return the same instance), mocking (for `new XXX` return an instance of another class YYY as a result)

Pointcut syntax is: `initialization(ClassTypePattern)`, for example, `initialization(Demo\**)` - intercept all instances creation inside Demo namespace and it's subnamespaces.

To enable this functionality, enable it in the features:

```php
AwesomeAspectKernel::getInstance()->init(array(
'debug' => true,
'appDir' => __DIR__ . '/../demos',
'cacheDir' => __DIR__ . '/cache',

'features' => $defaultFeatures | Features::INTERCEPT_INITIALIZATIONS,
));
```