1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlibabaCloud\Client\Filter; |
4
|
|
|
|
5
|
|
|
use AlibabaCloud\Client\Exception\ClientException; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class ClientFilter |
9
|
|
|
* |
10
|
|
|
* @package AlibabaCloud\Client\Filter |
11
|
|
|
*/ |
12
|
|
|
class ClientFilter |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @param $regionId |
16
|
|
|
* |
17
|
|
|
* @return string |
18
|
|
|
* |
19
|
|
|
* @throws ClientException |
20
|
|
|
*/ |
21
|
132 |
|
public static function regionId($regionId) |
22
|
|
|
{ |
23
|
132 |
|
if (!is_string($regionId)) { |
24
|
4 |
|
throw new ClientException( |
25
|
4 |
|
'Region ID must be a string', |
26
|
|
|
\ALIBABA_CLOUD_INVALID_ARGUMENT |
27
|
4 |
|
); |
28
|
|
|
} |
29
|
|
|
|
30
|
128 |
|
if ($regionId === '') { |
31
|
4 |
|
throw new ClientException( |
32
|
4 |
|
'Region ID cannot be empty', |
33
|
|
|
\ALIBABA_CLOUD_INVALID_ARGUMENT |
34
|
4 |
|
); |
35
|
|
|
} |
36
|
|
|
|
37
|
124 |
|
return $regionId; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param $clientName |
42
|
|
|
* |
43
|
|
|
* @return string |
44
|
|
|
* |
45
|
|
|
* @throws ClientException |
46
|
|
|
*/ |
47
|
174 |
|
public static function clientName($clientName) |
48
|
|
|
{ |
49
|
174 |
|
if (!is_string($clientName)) { |
50
|
5 |
|
throw new ClientException( |
51
|
5 |
|
'Client Name must be a string', |
52
|
|
|
\ALIBABA_CLOUD_INVALID_ARGUMENT |
53
|
5 |
|
); |
54
|
|
|
} |
55
|
|
|
|
56
|
169 |
|
if ($clientName === '') { |
57
|
5 |
|
throw new ClientException( |
58
|
5 |
|
'Client Name cannot be empty', |
59
|
|
|
\ALIBABA_CLOUD_INVALID_ARGUMENT |
60
|
5 |
|
); |
61
|
|
|
} |
62
|
|
|
|
63
|
164 |
|
return strtolower($clientName); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param $connectTimeout |
68
|
|
|
* |
69
|
|
|
* @return mixed |
70
|
|
|
* @throws ClientException |
71
|
|
|
*/ |
72
|
48 |
|
public static function connectTimeout($connectTimeout) |
73
|
|
|
{ |
74
|
48 |
|
if ($connectTimeout === '') { |
75
|
1 |
|
throw new ClientException( |
76
|
1 |
|
'Connect Timeout cannot be empty', |
77
|
|
|
\ALIBABA_CLOUD_INVALID_ARGUMENT |
78
|
1 |
|
); |
79
|
|
|
} |
80
|
|
|
|
81
|
47 |
|
return $connectTimeout; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param $timeout |
86
|
|
|
* |
87
|
|
|
* @return mixed |
88
|
|
|
* @throws ClientException |
89
|
|
|
*/ |
90
|
49 |
|
public static function timeout($timeout) |
91
|
|
|
{ |
92
|
49 |
|
if ($timeout === '') { |
93
|
1 |
|
throw new ClientException( |
94
|
1 |
|
'Timeout cannot be empty', |
95
|
|
|
\ALIBABA_CLOUD_INVALID_ARGUMENT |
96
|
1 |
|
); |
97
|
|
|
} |
98
|
|
|
|
99
|
48 |
|
return $timeout; |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
|