...
@access		protected
@param		string		$method			Method XML-RPC
@param		array		$parameters		List of method parameters
@return		string
508997
static protected function encodeXmlParameter( $parameter ){
		switch( gettype( $parameter ) ){
			case 'object':
				foreach( get_object_vars( $parameter ) as $key => $value ){
					$value	= self::encodeXmlParameter( $value );
					$data[]	= '<member><name>'.$key.'</name>'.$value.'</member>';
				}
				return '<struct>'.join( $data ).'</struct>';
			case 'array':
				$data	= array();
				foreach( $parameter as $value )
					$data[]	= self::encodeXmlParameter( $value );	
				return '<array><data>'.join( $data ).'</data></array>';
			case 'int':
			case 'integer':
				return '<value><int>'.$parameter.'</int></value>';
			case 'bool':
			case 'boolean':
				return '<value><boolean>'.( (int) $parameter ).'</boolean></value>';
			case 'double':
			case 'float':
				return '<value><double>'.$parameter.'</double></value>';
			case 'string':
				return '<value><string>'.$parameter.'</string></value>';
		}
	}
463807
private function _sqlFromMethod($method)
    {
        if(!preg_match('/^(findBy|oneBy)(.*?)$/', $method, $m))
            throw new \BadMethodCallException("Unable to parse $method");

        // split on AND or OR and case boundries
        $sql = strtolower(preg_replace('/(?<=[a-z0-9\b])(Or|And)(?=[A-Z])/',' $1 ',$m[2]));

        // add parameter binds
        return preg_replace_callback('/\b([\w-]+)\b/', function($m) {
            return ($m[0] != 'or' && $m[0] != 'and') ? "`{$m[0]}`=?" : $m[0];
        }, $sql);
    }
114036
protected function baseString(Uri $url, $method = 'POST', array $parameters = array())
    {
        $baseString = rawurlencode($method).'&';

        $schemeHostPath = Uri::fromParts(array(
           'scheme' => $url->getScheme(),
           'host' => $url->getHost(),
           'path' => $url->getPath(),
        ));

        $baseString .= rawurlencode($schemeHostPath).'&';

        $data = array();
        parse_str($url->getQuery(), $query);
        $data = array_merge($query, $parameters);

        // normalize data key/values
        array_walk_recursive($data, function (&$key, &$value) {
            $key   = rawurlencode(rawurldecode($key));
            $value = rawurlencode(rawurldecode($value));
        });
        ksort($data);

        $baseString .= $this->queryStringFromData($data);

        return $baseString;
    }
649802
public function parameterize($method)
    {
        $parameterArray = array();
        switch ($method) {
            case 'create':
                $parameterArray['token'] = $this->getToken();
                $parameterArray['client'] = $this->getClient();
                break;
            case 'delete':
                break;
            case 'getOne':
                $parameterArray['count'] = 1;
                $parameterArray['offset'] = 0;
                break;
            case 'getAll':
                $parameterArray = $this->getFilter();
                break;
        }

        return $parameterArray;
    }
1192955
private function buildRequestParams($method, $parameters = array()) {

        switch ($this->mode) {
            case 'client':
                $parameters['email'] = $this->email;
                $parameters['tkn']   = $this->token;
                $parameters['a']     = $method;
                break;
            case 'host':
                $parameters['host_key'] = $this->host_key;
                $parameters['act']      = $method;
                break;
        }


        return $parameters;
    }
251841
protected function getMethodCode($method)
    {
        $reflection = new \ReflectionMethod($this->model, $method);

        $file = new \SplFileObject($reflection->getFileName());
        $file->seek($reflection->getStartLine() - 1);

        $methodCode = '';

        while ($file->key() < $reflection->getEndLine()) {
            $methodCode .= $file->current();

            $file->next();
        }

        $methodCode = trim(preg_replace('/\s\s+/', '', $methodCode));

        $start = strpos($methodCode, 'function(');
        $length = strrpos($methodCode, '}') - $start + 1;

        return substr($methodCode, $start, $length);
    }
1078460
public function request($method, $path = null, $parameters = array())
    {
        if (null === $path) {
            $url = '/messages';
        } else {
            $url  = '/messages/'.$path;
        }

        return json_decode($this->requestRaw($method, $url, $parameters), true);
    }
1215426
public function command($method, array $parameters = [])
    {
        $start = microtime(true);

        $result = $this->client->{$method}(...$parameters);

        $time = round((microtime(true) - $start) * 1000, 2);

        if (isset($this->events)) {
            $this->event(new CommandExecuted($method, $parameters, $time, $this));
        }

        return $result;
    }
988248
private function getParameterNamesForDecoratedCall(array $parameters) : array
    {
        return array_map(
            static function (ReflectionParameter $parameter) {
                $name = '';

                if (method_exists($parameter, 'isVariadic')) {
                    if ($parameter->isVariadic()) {
                        $name .= '...';
                    }
                }

                return $name . '$' . $parameter->name;
            },
            $parameters
        );
    }
85368
protected function callSoapMethod($method)
    {
        $args = func_get_args();
        array_shift($args);

        LogHandler::log($args, LoggerInterface::LEVEL_INFO, 'request_object');

        try {
            $response = call_user_func_array([$this->getSoapClient(), $method], $args);
            LogHandler::log($response, LoggerInterface::LEVEL_INFO, 'response_object');
        } catch (\SoapFault $e) {
            LogHandler::log(
                'SOAP ERROR (' . $e->faultcode . '): ' . $e->getMessage(),
                LoggerInterface::LEVEL_ERROR,
                'error'
            );
            throw new \SoapFault($e->faultcode, $e->faultstring);
        }

        $this->validateResponseCertificate();

        LogHandler::log(
            "Response certificate validated successfully",
            LoggerInterface::LEVEL_INFO,
            'response_certificate_validated'
        );

        return $response;
    }
250300
protected function getBody($method)
    {
        $file = $this->getArgument("file");
        if (!is_null($file)) {
            return "file:$file";
        }
        if (count($this->getArguments($method)) > 0) {
            return json_encode($this->getArguments($method));
        }
        return "";
    }
1205373
public function getParameters($method)
    {
        //Loop through the default values for paremeters, and make the correct output string
        $params = array();
        $paramsWithDefault = array();
        foreach ($method->getParameters() as $param) {
            $paramStr = '$' . $param->getName();
            $params[] = $paramStr;
            if ($param->isOptional()) {
                $default = $param->isDefaultValueAvailable() ? $param->getDefaultValue() : null;
                if (is_bool($default)) {
                    $default = $default ? 'true' : 'false';
                } elseif (is_array($default)) {
                    $default = 'array()';
                } elseif (is_null($default)) {
                    $default = 'null';
                } elseif (is_int($default)) {
                    //$default = $default;
                } elseif (is_resource($default)) {
                    //skip to not fail
                } else {
                    $default = "'" . trim($default) . "'";
                }
                $paramStr .= " = $default";
            }
            $paramsWithDefault[] = $paramStr;
        }

        $this->params = $params;
        $this->params_with_default = $paramsWithDefault;
    }
318079
private function getResponse($method, $path, $parameters)
    {
        try {
            $response = $this->adapter->request($method, $path, $parameters);
            return $this->getResult($response);
        }
        catch (\Exception $e) {
            return $e->getMessage();
        }
    }
578144
public function get ($method, $options = array ()) {
		$req = $this->site . $this->element_name_plural;
        if (isset ($this->_data['id']) && $this->_data['id']) { 
          $req .= '/' . $this->_data['id'];
        }
        $req .= '/' . $method . '.xml';
		if (count ($options) > 0) {
			$req .= '?' . http_build_query ($options);
		}
		return $this->_send_and_receive ($req, 'GET');
	}
1039347
protected function xmlrpc_call($method, $array)
    {
        $this->_checkConfig();

        if (!isset($method) || !is_string($method)) {
            throw new Klarna_InvalidTypeException('method', 'string');
        }
        if ($array === null || count($array) === 0) {
            throw new KlarnaException("Parameterlist is empty or null!", 50067);
        }
        if (self::$disableXMLRPC) {
            return true;
        }
        try {
            /*
             * Disable verifypeer for CURL, so below error is avoided.
             * CURL error: SSL certificate problem, verify that the CA
             * cert is OK.
             * Details: error:14090086:SSL
             * routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (#8)
             */
            $this->xmlrpc->verifypeer = false;

            $timestart = microtime(true);

            //Create the XMLRPC message.
            $msg = new xmlrpcmsg($method);
            $params = array_merge(
                array(
                    $this->PROTO, $this->VERSION
                ), $array
            );

            $msg = new xmlrpcmsg($method);
            foreach ($params as $p) {
                if (!$msg->addParam(
                    php_xmlrpc_encode($p, array('extension_api'))
                )
                ) {
                    throw new KlarnaException(
                        "Failed to add parameters to XMLRPC message.",
                        50068
                    );
                }
            }

            $selectDateTime = microtime(true);
            if (self::$xmlrpcDebug) {
                $this->xmlrpc->setDebug(2);
            }
            //Save previous XML RPC client encoding settings.
            $tmp_xmlrpc_defencoding = $GLOBALS['xmlrpc_defencoding'];
            $tmp_xmlrpc_internalencoding = $GLOBALS['xmlrpc_internalencoding'];
            //Set XML RPC client encoding settings.
            $GLOBALS['xmlrpc_defencoding'] = 'ISO-8859-1';
            $GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';

            //Send the message.
            $xmlrpcresp = $this->xmlrpc->send($msg);

            //Restore previous XML RPC client encoding settings.
            $GLOBALS['xmlrpc_defencoding'] = $tmp_xmlrpc_defencoding;
            $GLOBALS['xmlrpc_internalencoding'] = $tmp_xmlrpc_internalencoding;

            //Calculate time and selectTime.
            $timeend = microtime(true);
            $time = (int) (($selectDateTime - $timestart) * 1000);
            $selectTime = (int) (($timeend - $timestart) * 1000);

            $status = $xmlrpcresp->faultCode();

            if ($status !== 0) {
                throw new KlarnaException($xmlrpcresp->faultString(), $status);
            }

            return php_xmlrpc_decode($xmlrpcresp->value());
        }
        catch(KlarnaException $e) {
            //Otherwise it is caught below, and rethrown.
            throw $e;
        }
        catch(Exception $e) {
            throw new KlarnaException($e->getMessage(), $e->getCode());
        }
    }
851954
public function call(string $method, array $parameters)
    {
        if ($this->isSingleRequest) {
            $this->units = [];
        }

        $this->units[] = new Invoke($this->generatorId->get(), $method, $parameters);

        if ($this->isSingleRequest) {
            $resultSpecifier = $this->execute(new InvokeSpec($this->units, true));

            if (!$resultSpecifier->isSingleResult()) {
                throw new InvalidResponseException();
            }

            list($result) = $resultSpecifier->getResults();

            if ($result instanceof Result) {
                /** @var Result $result */
                return $result->getResult();
            } elseif ($result instanceof Error) {
                /** @var Error $result */
                if ($this->serverErrorMode === self::ERRMODE_EXCEPTION) {
                    throw $result->getBaseException();
                }
            }

            return null;
        }

        return $this;
    }
94378
protected function formatExceptionParams($message, $parameters)
    {
        if (trim($message) === '' || $parameters === null) {
            return $message;
        }

        if (is_array($parameters) === false) {
            $parameters = [$parameters];
        }

        return @vsprintf($message, $parameters);
    }