Create the payload

@param array $auth
@param array $params
@return array
329074
private function payload(array $auth, array $params)
    {
        $payload = array_merge($auth, $params);
        $payload = array_change_key_case($payload, CASE_LOWER);

        ksort($payload);

        return $payload;
    }
1301936
public function createRequest($class, array $params = [])
    {
        $instance = new $class($this->getHttpClient());

        return $instance->configure(array_replace($this->getOptions(), $params));
    }
999987
public static function create($params = null, $options = null)
    {
        $opts = \Stripe\Util\RequestOptions::parse($options);
        if (is_null($opts->apiBase)) {
            $opts->apiBase = Stripe::$apiUploadBase;
        }
        // Manually flatten params, otherwise curl's multipart encoder will
        // choke on nested arrays.
        // TODO: use array_column() once we drop support for PHP 5.4
        $flatParams = [];
        foreach (\Stripe\Util\Util::flattenParams($params) as $pair) {
            $flatParams[$pair[0]] = $pair[1];
        }
        return static::_create($flatParams, $opts);
    }
55626
public static function create(array $payload)
    {
        // MessageEvent & MessageEchoEvent
        if (isset($payload['message'])) {
            if (isset($payload['message']['is_echo'])) {
                return self::createMessageEchoEvent($payload);
            }

            return self::createMessageEvent($payload);
        }
        
        // PostbackEvent
        if (isset($payload['postback'])) {
            return self::createPostbackEvent($payload);
        }

        // AuthenticationEvent
        if (isset($payload['optin'])) {
            return self::createAuthenticationEvent($payload);
        }

        // AccountLinkingEvent
        if (isset($payload['account_linking'])) {
            return self::createAccountLinkingEvent($payload);
        }

        // MessageDeliveryEvent
        if (isset($payload['delivery'])) {
            return self::createMessageDeliveryEvent($payload);
        }

        // MessageReadEvent
        if (isset($payload['read'])) {
            return self::createMessageReadEvent($payload);
        }

        // ReferralEvent
        if(isset($payload['referral'])) {
            return self::createReferralEvent($payload);
        }

        return new RawEvent($payload['sender']['id'], $payload['recipient']['id'], $payload);
    }
839445
public function with(array $auth, array $api_url = null)
    {
        $api_url = $api_url ?: config('livecoin.url');
        $this->client = new Client($auth, $api_url);
        return $this;
    }
102796
public function buildAuthUrl(OAuthToken $requestToken = null, array $params = [])
    {
        if (!is_object($requestToken)) {
            $requestToken = $this->getState('requestToken');
            if (!is_object($requestToken)) {
                throw new InvalidParamException('Request token is required to build authorize URL!');
            }
        }
        $params['oauth_token'] = $requestToken->getToken();

        return $this->composeUrl($this->authUrl, $params);
    }
133060
public static function createAccountLinkingEvent(array $payload)
    {
        $accountLinking = AccountLinking::create($payload['account_linking']);
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];

        return new AccountLinkingEvent($senderId, $recipientId, $timestamp, $accountLinking);
    }
316569
private function with(array $auth, array $urls = null)
    {
        $urls = $urls ?: config('yobit.urls');

        $client = new Client($auth, $urls);

        return $client;
    }
158356
public function createStreamFromArray(array $params)
    {
        $string = "";
        foreach ($params as $key => $value) {
            $string .= $key . '=' . urlencode(trim($value)) . '&';
        }

        $string = rtrim($string, "&");

        return $this->createStream($string);
    }
593748
protected function parseAuthenticationConfiguration(array $auth): array
    {
        $driver = $auth['defaults']['guard'] ?? null;

        $guard = $auth['guards'][$driver] ?? [
            'driver' => 'session',
            'provider' => 'users',
        ];

        $provider = $auth['providers'][$guard['provider']] ?? [
            'driver' => 'eloquent',
            'model' => User::class,
        ];

        return \compact('guard', 'provider');
    }
923256
public static function createFromArray(array $params)
    {
        return new static(
            isset($params['method']) ? $params['method'] : 'GET',
            new Uri(isset($params['uri']) ? $params['uri'] : ''),
            isset($params['headers']) ? $params['headers'] : array(),
            isset($params['body']) ? (is_resource($params['body']) ? new Stream($params['body']) : Stream::createFromContents($params['body'])) : Stream::createFromContents(''),
            isset($params['server']) ? $params['server'] : array(),
            isset($params['cookies']) ? $params['cookies'] : array()
        );
    }
61298
protected function createPreOneTwentySeven( $params ) {
		$newParams = [
			'name' => $params['username'],
			'password' => $params['password'],
		];
		if ( array_key_exists( 'email', $params ) ) {
			$newParams['email'] = $params['email'];
		}
		// First get the token.
		$tokenRequest = new SimpleRequest( 'createaccount', $newParams );
		$result = $this->api->postRequest( $tokenRequest );
		if ( $result['createaccount']['result'] == 'NeedToken' ) {
			// Then send the token to create the account.
			$newParams['token'] = $result['createaccount']['token'];
			$request = new SimpleRequest( 'createaccount', $newParams );
			$result = $this->api->postRequest( $request );
		}
		return ( $result['createaccount']['result'] === 'Success' );
	}
875254
protected function _request(array $params)
    {
        $client = new Client();
        $options = [
            'headers' => [
                'X-Api-Key' => $this->apiKey
            ]
        ];

        if ( $this->httpAuthUsername && $this->httpAuthPassword ) {
            $options['auth'] = [
                $this->httpAuthUsername,
                $this->httpAuthPassword
            ];
        }

        if ( $params['type'] == 'get' ) {
            $url = $this->url . '/api/' . $params['uri'] . '?' . http_build_query($params['data']);

            return $client->get($url, $options);
        }

        if ( $params['type'] == 'put' ) {
            $url = $this->url . '/api/' . $params['uri'];
            $options['json'] = $params['data'];

            return $client->put($url, $options);
        }

        if ( $params['type'] == 'post' ) {
            $url = $this->url . '/api/' . $params['uri'];
            $options['json'] = $params['data'];

            return $client->post($url, $options);
        }

        if ( $params['type'] == 'delete' ) {
            $url = $this->url . '/api/' . $params['uri'] . '?' . http_build_query($params['data']);

            return $client->delete($url, $options);
        }
    }
666493
public function addOAuthProvider($params = array())
    {
        $params = $this->checkFilterParams($params, array('type', 'provider_consumer_key', 'provider_consumer_secret'),
            array('type', 'provider_consumer_key', 'provider_consumer_secret'));
        if ($params === false) {
            throw new \InvalidArgumentException("params array contains invalid parameters or misses required parameters");
        }

        return $this->lastRequest->post(null, 'oauth_providers', $params);
    }
382228
private function createSignature($secret, $params)
    {
        $tokenData = $this->base64UriEncode(json_encode($params));

        $hash = $this->hash($secret.$tokenData);

        return $hash.'.'.$tokenData;
    }
1059964
public function getRequestHeaders($auth = true)
    {
        $headers = \getallheaders();
        if($auth) {
            $hmac = $this->getRest()->getServer()->getHmac();
            $return = array(
                $hmac->getPrefix().'timestamp' => (isset($headers[$hmac->getPrefix().'timestamp']) ? $headers[$hmac->getPrefix().'timestamp'] : ''),
                $hmac->getPrefix().'signature' => (isset($headers[$hmac->getPrefix().'signature']) ? $headers[$hmac->getPrefix().'signature'] : ''),
                $hmac->getPrefix().'key' => (isset($headers[$hmac->getPrefix().'key']) ? $headers[$hmac->getPrefix().'key'] : ''),
                $hmac->getPrefix().'version' => (isset($headers[$hmac->getPrefix().'version']) ? $headers[$hmac->getPrefix().'version'] : ''),
            );
            $headers = $return;
        }
        
        return $headers;
    }
372198
public function createBucket($params)
    {
        $params['token'] = jwt_encode(['scope' => 'bos.bucket.create'], 60, $this->_admin_key);

        $endpoint = preg_replace('#\{bucket\}[-.]*#', '', $this->_endpoint);

        if (str_contains($this->_endpoint, '{bucket}')) {
            $params['base_url'] = str_replace('{bucket}', $params['bucket'], $this->_endpoint);
        }

        $body = rest_post($endpoint . '/api/buckets', $params)['body'];

        $this->logger->info($body, 'bosClient.createBucket');

        if ($body['code'] !== 0) {
            throw new Exception($body['message'], $body['code']);
        }

        return $body['data'];
    }