Call a method and return the response as an associative array.

@param string $methodName The method to call.
@param array  $parameters Parameters for the method.

@return array|false
@throws ChaincoinException
166452
public function callMethod($methodName, array $parameters = array())
	{
		$this->_status = null;
		$this->_response = null;
		$this->_rawResponse = null;
		$this->_error = null;

		$parameters = array_values($parameters);

		$this->_id++;

		$input = json_encode(array(
			'method' => $methodName,
			'params' => $parameters,
			'id' => $this->_id
		));

		$curlResource = curl_init("{$this->_protocol}://{$this->_user}:{$this->_password}@{$this->_host}:{$this->_port}");
		$curlOptions = array(
			CURLOPT_RETURNTRANSFER => true,
			CURLOPT_FOLLOWLOCATION => true,
			CURLOPT_HTTPHEADER => array("Content-type: application/json"),
			CURLOPT_POST => true,
			CURLOPT_POSTFIELDS => $input,
		);

		if ($this->_protocol == 'https')
		{
			if ($this->_cert != null)
			{
				$curlOptions[CURLOPT_CAINFO] = $this->_cert;
				$curlOptions[CURLOPT_CAPATH] = dirname($this->_cert);
				$curlOptions[CURLOPT_SSL_VERIFYPEER] = true;
				$curlOptions[CURLOPT_SSL_VERIFYHOST] = true;
			}
			else
			{
				$curlOptions[CURLOPT_SSL_VERIFYPEER] = false;
				$curlOptions[CURLOPT_SSL_VERIFYHOST] = false;
			}
		}

		curl_setopt_array($curlResource, $curlOptions);

		$this->_rawResponse = curl_exec($curlResource);

		$this->_response = json_decode($this->_rawResponse,
			$this->getOption(self::OPTION_RESPONSE_FORMAT, self::RESPONSE_ASSOC_ARRAY) == self::RESPONSE_ASSOC_ARRAY);

		$this->_status = curl_getinfo($curlResource, CURLINFO_HTTP_CODE);

		$curlError = curl_error($curlResource);

		curl_close($curlResource);

		if ($curlError)
		{
			$this->_error = $curlError;

			return false;
		}

		if ($this->_response['error'])
		{
			$this->_error = $this->_response['error']['message'];
			$this->_errorCode = $this->_response['error']['code'];
		}
		else if ($this->_status != 200)
		{
			switch ($this->_status)
			{
				case 400:
					$this->_error = "HTTP_BAD_REQUEST";
					break;
				case 401:
					$this->_error = "HTTP_UNAUTHORIZED";
					break;
				case 403:
					$this->_error = "HTTP_FORBIDDEN";
					break;
				case 404:
					$this->_error = "HTTP_NOT_FOUND";
					break;
				default:
					throw new ChaincoinException("An unexpected http response code was encountered!");
			}
		}

		if ($this->_error)
		{
			return false;
		}

		return $this->_response['result'];
	}
18960
public function formatParameters(array $parameters, $keyString = null, $nested = false)
    {
        foreach ($parameters as $key => $value) {
            if (null !== $keyString && true === $nested) {
                $keyString = sprintf('%s[%s]', $keyString, $key);
            } else {
                $keyString = $key;
            }

            if (is_array($value)) {
                $this->formatParameters($value, $keyString, true);

                continue;
            } else {
                $this->formatedParameters[$keyString] = $value;
            }
        }

        return $this->formatedParameters;
    }
566680
private function getTokens($methodName)
    {
        preg_match_all('([A-Z_-][^A-Z_-]*)', $methodName, $rawTokens);
        $result = array();
        $lastToken = null;
        $seenBy = false;
        foreach ($rawTokens[0] as $token) {
            $newToken = $this->getToken($token, $seenBy);

            if ($newToken instanceof ValueToken) {
                $lastToken = $lastToken !== null && $lastToken instanceof ValueToken ?
                    new ValueToken($lastToken->getSource() . $newToken->getSource()) :
                    $newToken;
            } else {
                if ($lastToken instanceof ValueToken) {
                    // Add the last token too
                    $result[] = $lastToken;
                    $lastToken = null;
                }
                $result[] = $newToken;
            }
        }

        if ($lastToken !== null) {
            $result[] = $lastToken;
        }


        return $result;
    }
566243
public function callAction($method, $parameters)
    {
        $response = null;
        $this->method = $method;

        $result = parent::callAction($method, $parameters);

        if ($this->returnsArray) {
            if (!is_array($result)) {
                abort(500, 'Bad API response data.');
            }

            // Return JSON for AJAX and GET requests
            if (request()->ajax() || 'index' === $method || 'show' === $method) {
                $response = response()->json($result);

            // Return redirect-back and flash data for normal requests.
            } else {
                $response = empty($this->redirectUrl) ? back() : redirect($this->redirectUrl);
                foreach ($result as $key => $value) {
                    $response->with($key, $value);
                }
                if ('store' !== $method || isset($result['error'])) {
                    $response->withInput();
                }
            }
        } else {
            $response = $result;
        }

        return $response;
    }
1092585
public function getSimilar($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['tag'])) {
            $vars = array(
                'method' => 'tag.getsimilar',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);
            $similar = array();
            if ($call = $this->apiGetCall($vars)) {
                $i = 0;
                foreach ($call->similartags->tag as $tag) {
                    $similar[$i]['name'] = (string) $tag->name;
                    $similar[$i]['url'] = (string) $tag->url;
                    $similar[$i]['streamable'] = (string) $tag->streamable;
                    $i++;
                }
                return $similar;
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include tag variable in the call for this method');
        }
    }
180798
public function call(callable $callable, array $parameters = [])
	{
		if(is_array($callable))
		{
			$reflection = new ReflectionMethod($callable[0], $callable[1]);
		}
		else
		{
			$reflection = new ReflectionFunction($callable);
		}

		return $callable(...$this->resolveParameters($reflection->getParameters(), $parameters));
	}
209564
public static function addMethod($methodName, $methodCallable)
    {
        if (!is_callable($methodCallable)) {
            throw new InvalidArgumentException('Second param must be callable');
        }
        self::$methods[$methodName] = \Closure::bind($methodCallable, Mailer::instance(), get_class());
    }
988171
public static function objectsMethodValues(array $objectArray, string $methodName): array
    {
        $methodValues = [];

        foreach ($objectArray as $object) {
            $methodValues[] = $object->$methodName();
        }

        return $methodValues;
    }
835781
public function Run($functionName, $parameters)
	{
		if(!array_key_exists($functionName, $this->functions))
			return "\nError: The command '{$functionName}' does not exist\n";

		$response = $this->functions[$functionName]($parameters);
		
		return "\n{$response}\n";
	}
1277540
private function hasCall(string $methodName)
    {
        foreach ($this->getCalls() as $call) {
            if ($call->getMethodName() === $methodName) {
                return true;
            }
        }

        return false;
    }
970151
public function call($method, Array $params = [])
    {
        $rawResult = parent::call($method, $params);

        switch ($method) {
            case 'GetCarBrandAndModel':
                $result = $rawResult->GetCarBrandAndModelReturn->MakeModelBean;
            break;

            case 'GetCarBrand':
                $result = $rawResult->GetCarBrandReturn->x_car_brand->string;
        }

        return $result;
    }
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 ) );
	}
695418
protected function callScope($scope, $parameters)
    {
        array_unshift($parameters, $this);

        return call_user_func_array(array($this->model, $scope), $parameters) ?: $this;
    }
1236026
public function call(string $method, array $arguments): ResponseInterface
    {
        try {
            return $this->__soapCall($method, $arguments, null, $this->getHeader());
        } catch (\Exception $e) {
            $exception = new ClientException($e->getMessage(), $e->getCode(), $e);

            if ($this->debug) {
                $exception->request = ClientException::formatXml($this->__getLastRequest());
                $exception->response = ClientException::formatXml($this->__getLastResponse());
            }

            throw $exception;
        }
    }
631571
private function getMethodName($methodName)
    {
        $method = '';
        if($methodName) {
            $method  = strrpos($methodName, "::") !== false ? explode('::', $methodName) : null;
            if(!is_null($method) && is_array($method)) {
                $method = $method[1];
            }
        }

        return $method;
    }
364135
public function create($methodName, $params)
    {
        $newInstance = clone $this->injectorPrototype;

        if (!is_array($params)) {
            $params = array($params);
        }

        return $newInstance->setMethodName($methodName)->setParams($params);
    }
722170
protected function callModulesMethod($methodName)
    {
        $modules = Yii::$app->getModules();
        $returns = [];

        foreach ($modules as $moduleName => $module)
        {
            if (is_array($module)) {
                $module = Yii::$app->getModule($moduleName);
            }

            if (method_exists($module, $methodName)) {
                $returns[] = $module->$methodName();
            }
        }

        return $returns;
    }