Call a client method

@param string Method to call
@param ... Additional arguments
488074
public function command()
    {
        $cmd = func_get_args();

        if (strpos($cmd[0], 'plugin.') === 0) {
            $this->callbacks[] = $cmd;
        }
        else {
            $this->commands[] = $cmd;
        }
    }
557323
@Override
    public void invoke(String method, IPendingServiceCallback callback) {
        log.debug("invoke method: {} params {} callback {}", new Object[] { method, callback });
        // get it from the conn manager
        if (conn != null) {
            conn.invoke(method, callback);
        } else {
            log.info("Connection was null");
            PendingCall result = new PendingCall(method);
            result.setStatus(Call.STATUS_NOT_CONNECTED);
            callback.resultReceived(result);
        }
    }
800920
public function call($method, $params = [])
    {
        if (null === $this->client) {
            $this->client = new Client([
                'base_uri' => static::API_URL,
                'content-type' => 'application/json',
            ]);
        }

        $requestParams = array_merge($this->defaultParams, [
            $method => [$params],
        ]);

        if ($this->sandbox) {
            $requestParams['apikey'] = self::SANDBOX_KEY;
        }

        $response = $this->client->post(null, ['body' => json_encode($requestParams)]);
        if ($response->getStatusCode() != 200) {
            throw new \Exception('Api http error: ' . $response->getStatusCode(), $response->getStatusCode());
        }

        $result = json_decode($response->getBody(), true);
        if (isset($result['error'])) {
            throw new \BadMethodCallException('Api error: ' . $result['error']['description'],
                $result['error']['code']);
        }

        return $result;
    }
988419
protected function callClientMethods($methods, $stopWhen = null)
    {
        $client = $this->getClient();
        $logger = $client->getLogger();
        $result = null;
        foreach ($methods as $callInfo) {
            foreach ($callInfo as $name => $arguments) {
                switch ($name) {
                    case 'streamFile':
                    case 'sayNumber':
                    case 'sayDigits':
                    case 'sayDateTime':
                        $this->sayInterruptable($name, $arguments);
                        break;
                    case 'waitDigit':
                        if (empty($this->mockedInput)) {
                            $client->onWaitDigit(false);
                        } else {
                            $digit = array_shift($this->mockedInput);
                            if ($digit == ' ') {
                                $client->onWaitDigit(false);
                            } else {
                                $client->onWaitDigit(true, $digit);
                            }
                        }
                        break;
                    default:
                        break;
                }
                $result = parent::callClientMethod($name, $arguments);
                if ($stopWhen !== null) {
                    if ($stopWhen($result)) {
                        return $result;
                    }
                }
            }
        }
        return $result;
    }
35253
public function call(string $method, RequestInterface $request)
    {
        try {
            $parameters = $request->toArray();

            return $this->__soapCall($method, ['parameters' => $parameters]);
        } catch (\Exception $exception) {
            if ($this->debug) {
                throw ClientException::create($this, $exception);
            }

            throw new ClientException($exception->getMessage(), $exception->getCode(), $exception);
        }
    }
604527
public function callArray($method, array $args = array())
    {
        //argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        return call_user_func_array(array($this, $method), $args);
    }
848093
public function addMethod($method, $callback)
        {
            $this->traceInternal("Added '" . $method . "' to " . __METHOD__ . "()");
            $this->callbacks[$method] = $callback;
        }
1232886
private function addCallback(string $method, $state) : void
    {
        $state = $this->makeCallable($state);
        $this->actions[$method] = $state;
    }
1367621
private function call($method, array $args)
    {
        $request = $this->rpcProtocol->encodeRequest($method, $args);

        $response = $this->transport->request($request);

        $response = $this->rpcProtocol->decodeValue($response);

        if ($response instanceof \Exception) {
            throw $response;
        }

        return $response;
    }
87784
private function addMethod($method)
    {
        $tokens = $this->methodParser->parse($method);
        $query = $this->queryBuilder->build($tokens, $this->tableName, $this->namingContention, $this->entityClass);
        if ($query->getResultMode() <= QueryBuilderResult::RESULT_SELECT_MULTIPLE) {
            $this->addSelectionMethod($query, $method);
        } else {
            $this->addIntResultMethod($query, $method);
        }

    }
849947
protected function callProtocolMethod(string $event, ...$parameters)
    {
        if (method_exists($this->protocol, $event)) {
            call_user_func_array([$this->protocol, $event], $parameters);
        }
    }
1120039
public static function extend($method, $callback = null)
    {
        if (is_array($method)) {
            foreach ($method as $key => $val) {
                self::$extend[strtolower($key)] = $val;
            }
        } else {
            self::$extend[strtolower($method)] = $callback;
        }
    }
731481
@Override
	public void Invoke(final String method, JSONArray args,
			HubInvokeCallback callback) {

		if (method == null)
        {
            throw new IllegalArgumentException("method");
        }

        if (args == null)
        {
            throw new IllegalArgumentException("args");
        }

        final String callbackId = mConnection.RegisterCallback(callback);

        HubInvocation hubData = new HubInvocation(mHubName, method, args, callbackId);

        String value = hubData.Serialize();

        mConnection.Send(value, new SendCallback() 
        {
			@Override
			public void OnSent(CharSequence messageSent) {
				Log.v(TAG, "Invoke of " + method + "sent to " + mHubName);
				// callback.OnSent() ??!?!?
			}

			@Override
			public void OnError(Exception ex) {
				// TODO Cancel the callback
				Log.e(TAG, "Failed to invoke " + method + "on " + mHubName);
				mConnection.RemoveCallback(callbackId);
				// callback.OnError() ?!?!?
			}
        });
    }
1022934
private function assertMethodExists(string $method): void
    {
        if (!method_exists($this, $method)) {
            throw new MethodDoesNotExistException(
                sprintf("Specified method \"%s\" does not exist", $method)
            );
        }
    }
488799
public function call(string $method)
    {
        $args = $this->getArgs($method);

        $return = call_user_func_array([$this, $method], $args);

        $out = $this->renderer->render($this->statusCode, $this->headers, $return);

        self::response()->addHeader('Content-Type', $this->renderer->getContentType());
        if ($this->renderer->sendHeader()) {
            foreach ($this->headers as $name => $value) {
                self::response()->addHeader('x-' . ucfirst($name), $value);
            }

            self::response()->setStatus($this->statusCode);
        }

        return $out;
    }
932491
private static function call($method, $attributes)
    {
        $extManager = self::$serviceContainer->get('neoclient.extension_manager');

        $response = $extManager->execute($method, $attributes);

        return $response;
    }
807340
public function call( $method, $parameters ){
		$params	= array();
		foreach( $parameters as $parameter )
			$params[]	= '<param>'.self::encodeXmlParameter( $parameter ).'</param>';
		$method	= '<methodName>'.$method.'</methodName>';
		$params	= '<params>'.join( $params ).'</params>';
		$call	= '<methodCall>'.$method.$params.'</methodCall>';
		return self::parseResponse( Net_HTTP_Post::sendData( $this->url, $call ) );
	}