Demo\Aspect\DynamicMethodsAspect::beforeMagicMethodExecution PHP Method

beforeMagicMethodExecution() public method

Unlike traditional "execution" pointcut, "dynamic" is checking the name of method in the runtime, allowing to write interceptors for __call more transparently.
public beforeMagicMethodExecution ( Go\Aop\Intercept\MethodInvocation $invocation )
$invocation Go\Aop\Intercept\MethodInvocation Invocation
    public function beforeMagicMethodExecution(MethodInvocation $invocation)
    {
        $obj = $invocation->getThis();
        // we need to unpack args from invocation args
        list($methodName, $args) = $invocation->getArguments();
        echo 'Calling Magic Interceptor for method: ', is_object($obj) ? get_class($obj) : $obj, $invocation->getMethod()->isStatic() ? '::' : '->', $methodName, '()', ' with arguments: ', json_encode($args), PHP_EOL;
    }