Generate request signature

@param string $type
@param array  $params

@return string
484938
private function sign($type, &$params)
	{

		ksort($params);
		$str4sign = implode('|', $params);
		$sign = md5($str4sign . $type . $this->configParams['secretKey']);

		return $sign;

	}
142821
private function _createRequest($type)
    {
        switch (strtolower($type)) {
            case "webapi":
                $obj = new Request\WebAPIRequest();
                break;
            case "smtp":
                $obj = new Request\SMTPReqeust();
                break;
            default:
                $obj = null;
        }

        return $obj;
    }
1216852
protected function _sign($params = array()) {
    $query = "";
    if (isset($params['sign_mode']) && $params['sign_mode'] == 1) {
      unset($params['items']);
    }
    if (is_array($params) && !empty($params)) {
      ksort($params);
      $query = $this->_buildQuery($params);
    }
    return md5($query . $this->clientSecret);
  }
215346
protected function request($path, $params = [], $type = 'GET')
    {
        $apiUrl = 'https://my.ipaymu.com';

        $uri = (new Uri($apiUrl))->withPath($path);
        $request = new Curl\Request();

        $params[ 'key' ] = $this->config['apiKey'];
        $params[ 'format' ] = 'json';

        switch ($type) {
            default:
            case 'GET':
                $this->response = $request->setUri($uri)->get($params);
                break;

            case 'POST':
                $request->addHeader('content-type', 'application/x-www-form-urlencoded');
                $this->response = $request->setUri($uri)->post($params);
                break;
        }

        // Try to get curl error
        if (false !== ($error = $this->response->getError())) {
            $this->errors = $error;
        } else {
            $body = $this->response->getBody();

            if (empty($body[ 'Status' ])) {
                return $body->getArrayCopy();
            } else {
                $this->errors[ $body[ 'Status' ] ] = $body[ 'Keterangan' ];
            }
        }

        return false;
    }
129191
function param($param, $type = null) {
		if ($param instanceof ExpressibleInterface) {
			$param = $param->get();
		}
		if ($param instanceof Expr) {
			return (string) $param;
		}
		
		$this->params[] = $param;
		$this->types[]  = $type;
		
		return "\$".count($this->params);
	}
483233
private static function paramValidator($param, $type)
    {
        $allowedTypes = explode('|', $type);

        foreach ($allowedTypes as $allowedType) {
            $validationFunction = 'is_' . $allowedType;
            if ($validationFunction($param)) {
                return true;
            }
        }

        return false;
    }
1029423
public function decodeParameters($types, $param)
    {
        if (!is_string($param)) {
            throw new InvalidArgumentException('The type or param to decodeParameters must be string.');
        }

        // change json to array
        if ($types instanceof stdClass && isset($types->outputs)) {
            $types = Utils::jsonToArray($types, 2);
        }
        if (is_array($types) && isset($types['outputs'])) {
            $outputTypes = $types;
            $types = [];

            foreach ($outputTypes['outputs'] as $output) {
                if (isset($output['type'])) {
                    $types[] = $output['type'];
                }
            }
        }
        $typesLength = count($types);
        $solidityTypes = $this->getSolidityTypes($types);
        $offsets = array_fill(0, $typesLength, 0);

        for ($i=0; $i<$typesLength; $i++) {
            $offsets[$i] = $solidityTypes[$i]->staticPartLength($types[$i]);
        }
        for ($i=1; $i<$typesLength; $i++) {
            $offsets[$i] += $offsets[$i - 1];
        }
        for ($i=0; $i<$typesLength; $i++) {
            $offsets[$i] -= $solidityTypes[$i]->staticPartLength($types[$i]);
        }
        $result = [];
        $param = mb_strtolower(Utils::stripZero($param));

        for ($i=0; $i<$typesLength; $i++) {
            if (isset($outputTypes['outputs'][$i]['name']) && empty($outputTypes['outputs'][$i]['name']) === false) {
                $result[$outputTypes['outputs'][$i]['name']] = $solidityTypes[$i]->decode($param, $offsets[$i], $types[$i]);
            } else {
                $result[$i] = $solidityTypes[$i]->decode($param, $offsets[$i], $types[$i]);
            }
        }

        return $result;
    }
209383
private function signature(array $params)
    {
        ksort($params);
        $accessKeySecret = $this->config['access_key_secret'];
        $stringToSign = 'POST&%2F&' . urlencode(http_build_query($params, null, '&', PHP_QUERY_RFC3986));
        return base64_encode(hash_hmac('sha1', $stringToSign, $accessKeySecret . '&', true));
    }
136420
public function createCustomerData($params)
    {
        Util::verifyKeys(
                self::$_createCustomerSignature,
                $params
                );
        $params["kind"] = TransparentRedirect::CREATE_CUSTOMER;
        return $this->_data($params);

    }
521063
protected function sendRequestHeaders($type, $url, &$params)
    {
        if (!is_array($params)) {
            $params = ['resultcb' => $params];
        }
        if (!isset($params['uri']) || !isset($params['host'])) {
            $prepared = Pool::parseUrl($url);
            if (!$prepared) {
                if (isset($params['resultcb'])) {
                    $params['resultcb'](false);
                }
                return;
            }
            list($params['host'], $params['uri']) = $prepared;
        }
        if ($params['uri'] === '') {
            $params['uri'] = '/';
        }
        $this->lastURL = 'http://' . $params['host'] . $params['uri'];
        if (!isset($params['version'])) {
            $params['version'] = '1.1';
        }
        $this->writeln($type . ' ' . $params['uri'] . ' HTTP/' . $params['version']);
        if (isset($params['proxy'])) {
            if (isset($params['proxy']['auth'])) {
                $this->writeln('Proxy-Authorization: basic ' . base64_encode($params['proxy']['auth']['username'] . ':' . $params['proxy']['auth']['password']));
            }
        }
        $this->writeln('Host: ' . $params['host']);
        if ($this->pool->config->expose->value && !isset($params['headers']['User-Agent'])) {
            $this->writeln('User-Agent: phpDaemon/' . Daemon::$version);
        }
        if (isset($params['cookie']) && sizeof($params['cookie'])) {
            $this->writeln('Cookie: ' . http_build_query($params['cookie'], '', '; '));
        }
        if (isset($params['contentType'])) {
            if (!isset($params['headers'])) {
                $params['headers'] = [];
            }
            $params['headers']['Content-Type'] = $params['contentType'];
        }
        if (isset($params['headers'])) {
            $this->customRequestHeaders($params['headers']);
        }
        if (isset($params['rawHeaders']) && $params['rawHeaders']) {
            $this->rawHeaders = [];
        }
        if (isset($params['chunkcb']) && is_callable($params['chunkcb'])) {
            $this->chunkcb = $params['chunkcb'];
        }
        $this->writeln('');
        $this->requests->push($type);
        $this->onResponse->push($params['resultcb']);
        $this->checkFree();
    }
628697
public function verifyCallbackRequest(array $params)
    {
        return $this->signatureCallback
            ->setOrderId(array_get($params, 'Order_ID'))
            ->setStatus(array_get($params, 'Status'))
            ->setFields(array_except($params, ['Order_ID', 'Status', 'Signature']))
            ->setPassword($this->getPassword())
            ->verify(array_get($params, 'Signature'));
    }
1211865
public static function createObject($type, array $params = [])
    {
        if (is_string($type)) {
            return new $type;
        } elseif (is_array($type)) {
            $class = '\\PG\\I18N\\' . ($type['class'] ?? 'PhpMessageSource');
            unset($type['class']);
            $clazz = new $class;
            foreach ($type as $prop => $val) {
                $clazz->$prop = $val;
            }
            return $clazz;
        }

        throw new \Exception('Unsupported configuration type: ' . gettype($type));
    }
172054
protected function checkParam($param, $type)
    {
        $type = $this->getTypeRegexp($type);

        return (bool) preg_match("#^{$type}$#", $param);
    }
1097419
protected function getSignature(array $params)
    {
        ksort($params);

        $srcStr = 'POSTcdn.api.qcloud.com/v2/index.php?'.urldecode(http_build_query($params));

        return base64_encode(hash_hmac('sha1', $srcStr, $this->getCredentials()['secretKey'], true));
    }
1288717
protected function getIrcMessage($type, array $params = array())
    {
        $message = '';
        if ($this->prefix) {
            $message .= ':' . $this->prefix . ' ';
        }
        $message .= $type;

        $params = array_filter($params, function($param) {
            return $param !== null;
        });
        if ($params) {
            $last = end($params);
            $params[key($params)] = ':' . $last; 
            $message .= ' ' . implode(' ', $params);
        }
        
        $message .= "\r\n";
        return $message;
    }
308006
private static function getCacheKeyForCall(array $params)
    {
        static $domainLevel = null;

        $params += $_GET;
        $keyStr = '';
        foreach ($params as $param) {
            $keyStr .= serialize($param);
        }

        $keyStr .= Request::domainPrefix(
            $domainLevel ?? $domainLevel = count(explode('.', Config::application('domain')))
        );

        return md5($keyStr);
    }
183429
protected static function _buildWriteParams($params = array()) {
		$writeParams['equalKeysOnly'] = (
			isset($params['equalKeysOnly']) &&
			empty($params['equalKeysOnly']) ? false : true
		);

		return $writeParams;
	}