-
-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intercept function calls from the global namespace #53
Comments
lisachenko
added a commit
that referenced
this issue
May 17, 2013
lisachenko
added a commit
that referenced
this issue
May 17, 2013
lisachenko
added a commit
that referenced
this issue
May 17, 2013
Example of mocking use Go\Aop\Framework\FunctionAroundInterceptor;
use Go\Aop\Framework\ReflectionFunctionInvocation;
use Go\Aop\Intercept\FunctionInvocation;
function usleep($microseconds)
{
$interceptor = new FunctionAroundInterceptor(function (FunctionInvocation $invocation) {
echo 'Hello!';
return $invocation->proceed();
});
$joinpoint = new ReflectionFunctionInvocation('usleep', array($interceptor));
return $joinpoint(array($microseconds));
} |
lisachenko
added a commit
that referenced
this issue
May 23, 2013
lisachenko
added a commit
that referenced
this issue
Jul 28, 2013
lisachenko
added a commit
that referenced
this issue
Jul 28, 2013
lisachenko
added a commit
that referenced
this issue
Jul 28, 2013
lisachenko
added a commit
that referenced
this issue
Jul 28, 2013
lisachenko
added a commit
that referenced
this issue
Aug 4, 2013
* feature/function-interception: Add default value for flag to fix the tests Add flag to the container and to the options to switch on the support for function interception Update the demo aspect to use execution pointcut for functions Update the parse table and grammar for function executions Fix the tests (newline was added) Add PointcutParser class to automatically inject parse table and rename the test Add in-memory caching of function code to reduce the overhead of building the source code for same function Fix an error with composite function pointcuts Extend the ReflectionFunction with custom namespace names Add new demo for function interception Update production parse table for new grammar Add support for function interceptors Some cleaning and phpDocs Support for optional parameters and by reference passing Function proxy dirty implementation #53 Add function around implementation to the framework, needed for #53 Reflection function invocation class for #53 Base interfaces for function invocation and interception #53
Merged in 28e5e81 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
According to the official documentation http://www.php.net/manual/en/language.namespaces.rules.php there is a name resolution rule:
This rule can be used by Go! library to dynamically intercept global function calls in the namespaces. For example, if we want to intercept a function
file_get_contents()
in the application, we can create this function in the current namespace, so it will be used instead of global function.The text was updated successfully, but these errors were encountered: