private function getSecureMethodInvocation(MethodMetadata $method) { $code = 'new MethodInvocation(' . var_export($method->getReflection()->getDeclaringClass()->getName(), true) . ', ' . var_export($method->getReflection()->getName(), true) . ', $this' . ', array('; $arguments = array(); foreach ($method->getReflection()->getParameters() as $param) { $arguments[] = '$' . $param->getName(); } $code .= implode(', ', $arguments) . '))'; return $code; }