Blame view

vendor/alibabacloud/client/src/DefaultAcsClient.php 1.13 KB
f0d6cde5   xu   vendor
1
2
3
4
<?php

namespace AlibabaCloud\Client;

0c34aba8   xu   更新阿里云短信接口
5
use AlibabaCloud\Client\Result\Result;
f0d6cde5   xu   vendor
6
use AlibabaCloud\Client\Clients\Client;
0c34aba8   xu   更新阿里云短信接口
7
use AlibabaCloud\Client\Request\Request;
f0d6cde5   xu   vendor
8
9
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;
f0d6cde5   xu   vendor
10
11
12
13
14
15
16

/**
 * Class DefaultAcsClient
 *
 * @package    AlibabaCloud
 *
 * @deprecated deprecated since version 2.0, Use AlibabaCloud instead.
0c34aba8   xu   更新阿里云短信接口
17
 * @codeCoverageIgnore
f0d6cde5   xu   vendor
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 */
class DefaultAcsClient
{

    /**
     * @var string
     */
    public $randClientName;

    /**
     * DefaultAcsClient constructor.
     *
     * @param Client $client
     *
     * @throws ClientException
     */
    public function __construct(Client $client)
    {
        $this->randClientName = \uniqid('', true);
        $client->name($this->randClientName);
    }

    /**
     * @param Request|Result $request
     *
     * @return Result|string
     * @throws ClientException
     * @throws ServerException
     */
    public function getAcsResponse($request)
    {
        if ($request instanceof Result) {
            return $request;
        }

        return $request->client($this->randClientName)->request();
    }
}