You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
51 lines
1.1 KiB
2 months ago
|
<?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);
|
||
|
}
|
||
|
}
|