Hprose\Service::beforeInvoke PHP Method

beforeInvoke() private method

private beforeInvoke ( $name, array &$args, stdClas\stdClass $context )
$args array
$context stdClas\stdClass
    private function beforeInvoke($name, array &$args, stdClass $context)
    {
        try {
            $self = $this;
            if ($this->onBeforeInvoke !== null) {
                $onBeforeInvoke = $this->onBeforeInvoke;
                $value = call_user_func_array($onBeforeInvoke, array($name, &$args, $context->byref, $context));
                if ($value instanceof Exception || $value instanceof Throwable) {
                    throw $value;
                }
                if (Future\isFuture($value)) {
                    return $value->then(function ($value) use($self, $name, $args, $context) {
                        if ($value instanceof Exception || $value instanceof Throwable) {
                            throw $value;
                        }
                        return $self->invoke($name, $args, $context);
                    })->then(null, function ($error) use($self, $context) {
                        return $self->sendError($error, $context);
                    });
                }
            }
            return $this->invoke($name, $args, $context)->then(null, function ($error) use($self, $context) {
                return $self->sendError($error, $context);
            });
        } catch (Exception $error) {
            return $this->sendError($error, $context);
        }
    }