PHP 8.2.31
Preview: Request.php Size: 2.20 KB
/home/nshryvcy/blissfulnepal.com/wp-content/plugins/tourmaster/include/stripe/lib/ApiOperations/Request.php

<?php

namespace Stripe\ApiOperations;

/**
 * Trait for resources that need to make API requests.
 *
 * This trait should only be applied to classes that derive from StripeObject.
 */
trait Request
{
    /**
     * @param array|null|mixed $params The list of parameters to validate
     *
     * @throws \Stripe\Error\Api if $params exists and is not an array
     */
    protected static function _validateParams($params = null)
    {
        if ($params && !is_array($params)) {
            $message = "You must pass an array as the first argument to Stripe API "
               . "method calls.  (HINT: an example call to create a charge "
               . "would be: \"Stripe\\Charge::create(['amount' => 100, "
               . "'currency' => 'usd', 'source' => 'tok_1234'])\")";
            throw new \Stripe\Error\Api($message);
        }
    }

    /**
     * @param string $method HTTP method ('get', 'post', etc.)
     * @param string $url URL for the request
     * @param array $params list of parameters for the request
     * @param array|string|null $options
     *
     * @return array tuple containing (the JSON response, $options)
     */
    protected function _request($method, $url, $params = [], $options = null)
    {
        $opts = $this->_opts->merge($options);
        list($resp, $options) = static::_staticRequest($method, $url, $params, $opts);
        $this->setLastResponse($resp);
        return [$resp->json, $options];
    }

    /**
     * @param string $method HTTP method ('get', 'post', etc.)
     * @param string $url URL for the request
     * @param array $params list of parameters for the request
     * @param array|string|null $options
     *
     * @return array tuple containing (the JSON response, $options)
     */
    protected static function _staticRequest($method, $url, $params, $options)
    {
        $opts = \Stripe\Util\RequestOptions::parse($options);
        $baseUrl = isset($opts->apiBase) ? $opts->apiBase : static::baseUrl();
        $requestor = new \Stripe\ApiRequestor($opts->apiKey, $baseUrl);
        list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers);
        $opts->discardNonPersistentHeaders();
        return [$response, $opts];
    }
}

Directory Contents

Dirs: 0 × Files: 7

Name Size Perms Modified Actions
1019 B lrw-r--r-- 2024-05-28 15:48:43
Edit Download
757 B lrw-r--r-- 2024-05-28 15:48:43
Edit Download
655 B lrw-r--r-- 2024-05-28 15:48:43
Edit Download
3.51 KB lrw-r--r-- 2024-05-28 15:48:43
Edit Download
2.20 KB lrw-r--r-- 2024-05-28 15:48:43
Edit Download
671 B lrw-r--r-- 2024-05-28 15:48:43
Edit Download
1.26 KB lrw-r--r-- 2024-05-28 15:48:43
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).