@@ -13,16 +13,16 @@ class Client
13
13
const RESPONSE_SHORT = 1 ;
14
14
const RESPONSE_FULL = 2 ;
15
15
16
- protected $ _host ;
17
- protected $ _port ;
18
- protected $ _protocol ;
19
- protected $ _login ;
20
- protected $ _password ;
21
- protected $ _proxy = '' ;
22
- protected $ _secretKey ;
23
- protected $ _version = '' ;
16
+ protected string $ _host ;
17
+ protected int $ _port ;
18
+ protected string $ _protocol ;
19
+ protected string $ _login = '' ;
20
+ protected string $ _password = '' ;
21
+ protected string $ _proxy = '' ;
22
+ protected string $ _secretKey = '' ;
23
+ protected string $ _version = '' ;
24
24
25
- protected $ _operatorsCache = [];
25
+ protected array $ _operatorsCache = [];
26
26
27
27
/**
28
28
* @var callable
@@ -36,7 +36,7 @@ class Client
36
36
* @param int $port
37
37
* @param string $protocol
38
38
*/
39
- public function __construct ($ host , $ port = 8443 , $ protocol = 'https ' )
39
+ public function __construct (string $ host , int $ port = 8443 , string $ protocol = 'https ' )
40
40
{
41
41
$ this ->_host = $ host ;
42
42
$ this ->_port = $ port ;
@@ -49,7 +49,7 @@ public function __construct($host, $port = 8443, $protocol = 'https')
49
49
* @param string $login
50
50
* @param string $password
51
51
*/
52
- public function setCredentials ($ login , $ password )
52
+ public function setCredentials (string $ login , string $ password ): void
53
53
{
54
54
$ this ->_login = $ login ;
55
55
$ this ->_password = $ password ;
@@ -60,7 +60,7 @@ public function setCredentials($login, $password)
60
60
*
61
61
* @param string $secretKey
62
62
*/
63
- public function setSecretKey ($ secretKey )
63
+ public function setSecretKey (string $ secretKey ): void
64
64
{
65
65
$ this ->_secretKey = $ secretKey ;
66
66
}
@@ -70,7 +70,7 @@ public function setSecretKey($secretKey)
70
70
*
71
71
* @param string $proxy
72
72
*/
73
- public function setProxy ($ proxy )
73
+ public function setProxy (string $ proxy ): void
74
74
{
75
75
$ this ->_proxy = $ proxy ;
76
76
}
@@ -80,7 +80,7 @@ public function setProxy($proxy)
80
80
*
81
81
* @param string $version
82
82
*/
83
- public function setVersion ($ version )
83
+ public function setVersion (string $ version ): void
84
84
{
85
85
$ this ->_version = $ version ;
86
86
}
@@ -90,7 +90,7 @@ public function setVersion($version)
90
90
*
91
91
* @param callable|null $function
92
92
*/
93
- public function setVerifyResponse (callable $ function = null )
93
+ public function setVerifyResponse (callable $ function = null ): void
94
94
{
95
95
$ this ->_verifyResponseCallback = $ function ;
96
96
}
@@ -100,7 +100,7 @@ public function setVerifyResponse(callable $function = null)
100
100
*
101
101
* @return string
102
102
*/
103
- public function getHost ()
103
+ public function getHost (): string
104
104
{
105
105
return $ this ->_host ;
106
106
}
@@ -110,7 +110,7 @@ public function getHost()
110
110
*
111
111
* @return int
112
112
*/
113
- public function getPort ()
113
+ public function getPort (): int
114
114
{
115
115
return $ this ->_port ;
116
116
}
@@ -120,7 +120,7 @@ public function getPort()
120
120
*
121
121
* @return string
122
122
*/
123
- public function getProtocol ()
123
+ public function getProtocol (): string
124
124
{
125
125
return $ this ->_protocol ;
126
126
}
@@ -132,7 +132,7 @@ public function getProtocol()
132
132
*
133
133
* @return SimpleXMLElement
134
134
*/
135
- public function getPacket ($ version = null )
135
+ public function getPacket ($ version = null ): SimpleXMLElement
136
136
{
137
137
$ protocolVersion = !is_null ($ version ) ? $ version : $ this ->_version ;
138
138
$ content = "<?xml version='1.0' encoding='UTF-8' ?> " ;
@@ -295,7 +295,7 @@ protected function _getHeaders()
295
295
*
296
296
* @throws Exception
297
297
*/
298
- protected function _verifyResponse ($ xml )
298
+ protected function _verifyResponse ($ xml ): void
299
299
{
300
300
if ($ xml ->system && $ xml ->system ->status && 'error ' == (string ) $ xml ->system ->status ) {
301
301
throw new Exception ((string ) $ xml ->system ->errtext , (int ) $ xml ->system ->errcode );
@@ -315,7 +315,7 @@ protected function _verifyResponse($xml)
315
315
* @param string $request
316
316
* @param SimpleXMLElement $xml
317
317
*
318
- * @return string
318
+ * @return false| string
319
319
*/
320
320
protected function _expandRequestShortSyntax ($ request , SimpleXMLElement $ xml )
321
321
{
0 commit comments