ActionResolverTrait.php
1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
<?php
namespace AlibabaCloud\Client\Resolver;
use ReflectionClass;
use ReflectionException;
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Request\Request;
use AlibabaCloud\Client\Exception\ClientException;
/**
* @codeCoverageIgnore
* @mixin Rpc
* @mixin Roa
* @mixin Request
* @package AlibabaCloud\Client\Resolver
*/
trait ActionResolverTrait
{
/**
* Resolve Action name from class name
*/
private function resolveActionName()
{
if (!$this->action) {
$array = explode('\\', get_class($this));
$this->action = array_pop($array);
}
}
/**
* Append SDK version into User-Agent
*
* @throws ClientException
* @throws ReflectionException
*/
private function appendSdkUA()
{
if (!(new ReflectionClass(AlibabaCloud::class))->hasMethod('appendUserAgent')) {
return;
}
if (!class_exists('AlibabaCloud\Release')) {
return;
}
AlibabaCloud::appendUserAgent('SDK', \AlibabaCloud\Release::VERSION);
}
}