/** * To invoke the callback. * [Note: Do not call this function from your application, it is used internally] * * @param $instance * @param string $function * @param HttpRequest/HttpResponse $param * @throws InvalidOperation */ protected function InvokeCallBack($instance, $function, $param) { try { if ($function) { if ($instance) { $class = new ReflectionClass(get_class($instance)); $method = $class->getMethod($function); $method->Invoke($instance, $param); } else { $func = new ReflectionFunction($function); $func->Invoke($param); } } } catch (ReflectionException $exception) { throw new InvalidOperation($exception->getMessage()); } }